polygon

How to get the coordinates of a polygon in OpenLayers3 on draw end

半世苍凉 提交于 2019-12-11 05:17:17
问题 I have tried to add a click handler to the map, but am not sure how to tell when the polygon has finished drawing. Is there a simple function to get the polygon coordinates on draw end ? 回答1: You can probably adapt https://stackoverflow.com/a/24835176/228885 for your purposes. As mentioned in another answer feature.once('change', ...) might be another way to go. I expect in that case you would pick the last element from the feature passed to the handler. Then you would extract the coordinates

fill half of svg polygon shape - star

∥☆過路亽.° 提交于 2019-12-11 05:16:55
问题 I am using this and was looking to add a new css class 'half' to the star selected class, to only fill half the star shape with the background color: #e54800 https://foundation.zurb.com/building-blocks/blocks/star-rating.html So it would be: <div class="star selected half"> <div class="rating-block"> <div class="rating-block-rating" data-rating> <div class="star selected"> <svg xmlns="http://www.w3.org/2000/svg" width="40" height="37" viewBox="0 0 40 37"> <polygon fill="none" points="272 30

Adding a polygon to a scatter plotly

╄→гoц情女王★ 提交于 2019-12-11 04:29:25
问题 I have 5 clusters of x,y data I'm plotting using R 's plotly . Here are the data: set.seed(1) df <- do.call(rbind,lapply(seq(1,20,4),function(i) data.frame(x=rnorm(50,mean=i,sd=1),y=rnorm(50,mean=i,sd=1),cluster=i))) Here's the plot: library(plotly) clusters.plot <- plot_ly(marker=list(size=10),type='scatter',mode="markers",x=~df$x,y=~df$y,color=~df$cluster,data=df) %>% hide_colorbar() %>% layout(xaxis=list(title="X",zeroline=F),yaxis=list(title="Y",zeroline=F)) clusters.plot Now I'm creating

How to get a polygon from a Triangulated Face in Three.js?

喜你入骨 提交于 2019-12-11 04:26:19
问题 I looked up around the Net if this someone had the same problem. I'm working with three.js. I have a 3DObject, which may contain holes. The faces are triangulated. Let say I want to see it from above: my objective is to get a Polygon which represents the perimeter of the top face.(that means for me, no more triangulated faces but only 1 Polygon). My approach till now was the following: I used the Three.js function "EdgesGeometry" over a shape geometry to get a collection of unsorted lines

matplotlib.patches.Polygon function contains_point() fails to resolve a point in a patch

大憨熊 提交于 2019-12-11 04:17:04
问题 I am using matplotlib.patches.Polygon to update some colored patches on a graph, and I'm doing it at each iteration of the code. Since I already defined the patches in my code this way, I wanted to use the function contains_point() to resolve whether a point is in the patch or outside of it. So Far what seems working is shapely - but I wouldn't like to do so, I'd rather keep working using matplotlib. The problem arises after calling add_patch(): in this case the patch will return the same

Overlapping polygons of different colors

不羁岁月 提交于 2019-12-11 02:16:24
问题 Is it possible to prevent overlapping polygons from being darker at their intersection? Geocode's solution to drawing overlapping polygons at the same opacity works well for polygons of the same color, but not when there are multiple polygons. I've tried to wind the polygons in opposite directions but it had no effect. I also tried adjusting the polygon's zIndex, but that only really affected which color was dominant in the intersection. Here is the jsfiddle with my attempt at winding in

Reduce polygon area by percentage

风格不统一 提交于 2019-12-11 01:47:43
问题 I have a polygon that consists of points (x,y). What I woul like to do is to reduce this by a percentage. Keep in mind: I dont want to just scale it. The polygon should get a kind of inner border (its width depends on the percentage) that gets cut off the polygon. Who knows an algorithm that can achieve that? Input: Array of Points, Percentage Output: Array of Points 回答1: What you seek is the offset polygon . It is not easy to compute, but it has been quite well-studied. Perhaps the answer to

Randomly placing a polygon inside of polygon

霸气de小男生 提交于 2019-12-11 00:47:30
问题 I have two polygons defined as a series of 2D floating point values. They are not guaranteed to be concave or convex. They do not cross over themselves. They cannot rotate. I want to place one randomly inside the other should it be possible based on it's size. The main problem is efficiency. I have to do this about 200 or so times in a few seconds. I've been looking into this for a couple of days now, and have made no discernible headway. Any leads would be appreciated. 回答1: Disclaimer: If

How to reference positions of other entities in polygon hierarchy of Cesium using javascript?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 00:23:08
问题 I am using Cesium to visualize my scenario and I want to create a polygon in JavaScript using position of other moving entities as references for its endpoints. As suggested in the answer of this question by using CZML . I was wondering if I can do it (referencing positions of other entities as endpoints of my polygon) in JavaScript . I tried a few things and it didn't work, for example, following is my code: var newPoly= viewer.entities.add({ id : resourceSet[objIndex].id+"poly", name

How to draw a polygon like google map in android app?

扶醉桌前 提交于 2019-12-10 21:47:54
问题 I am creating a map app for a place for my city and i want to draw a polygon around that place. i have a example of my app idea in web google map like this picture: How can i do like this ? 回答1: Original documentation has clear explanation for Polygon API. All that you need to do is use this method with own coordinates and colors: GoogleMap map; // ... get a map. // Add a triangle in the Gulf of Guinea Polygon polygon = map.addPolygon(new PolygonOptions() .add(new LatLng(0, 0), new LatLng(0,