WhirlyGlobe icon indicating copy to clipboard operation
WhirlyGlobe copied to clipboard

v2.6.5 issue with displaying addVectors

Open ForTraces opened this issue 2 years ago • 8 comments

hello: I use the addVectors method to draw the area,The properties are as follows @{ kMaplyDrawPriority: @(kMaplyVectorDrawPriorityDefault), kMaplyVecWidth: @(6.0), kMaplyFilled:@YES,

};

When a lat/long crosses 180, the padding becomes abnormal 图片

ForTraces avatar Jun 08 '22 12:06 ForTraces

Looks like the polygon may be in the wrong order. I'd try reordering it and see if that helps.

sjg-wdw avatar Jun 08 '22 15:06 sjg-wdw

NSDictionary *invecDes = @{ kMaplyDrawPriority: @(kMaplyShapeDrawPriorityDefault), kMaplyFilled:@(YES), kMaplyVecWidth: @(6.0) };

NSArray *points = @[@{@"lon":@"171.824569",@"lat":@"26.289429"}, @{@"lon":@"-174.022374",@"lat":@"26.406445"}, @{@"lon":@"177.511999",@"lat":@"16.911654"}, @{@"lon":@"162.878838",@"lat":@"16.045829"}, ];

MaplyCoordinate coords[points.count]; for (int i = 0; i < points.count; i++) { NSDictionary *dict = points[i]; coords[i]= MaplyCoordinateMakeWithDegrees([dict[@"lon"] doubleValue],[dict[@"lat"] doubleValue]); } MaplyVectorObject *vec = [[MaplyVectorObject alloc] initWithAreal:coords numCoords:(int)points.count attributes:@{kMaplyColor:[UIColor redColor]}];

[self.baseViewC addVectors:@[vec] desc:invecDes mode:MaplyThreadCurrent];

When I set kMaplyFilled to NO it is normal, 图片

I set kMaplyFilled to YES the drawing is wrong 图片

ForTraces avatar Jun 09 '22 02:06 ForTraces

All we're doing is passing the data to the old GL tessellator. So you'll want to try a few things to figure out what it doesn't like your polygon:

  • Are there duplicate points?
  • Is this the wrong winding order? Try reversing it.
  • Look at other examples and see if there's anything different from yours.

sjg-wdw avatar Jun 09 '22 15:06 sjg-wdw

All we're doing is passing the data to the old GL tessellator. So you'll want to try a few things to figure out what it doesn't like your polygon:

* Are there duplicate points?

* Is this the wrong winding order?  Try reversing it.

* Look at other examples and see if there's anything different from yours.

All we're doing is passing the data to the old GL tessellator. So you'll want to try a few things to figure out what it doesn't like your polygon:

* Are there duplicate points?

* Is this the wrong winding order?  Try reversing it.

* Look at other examples and see if there's anything different from yours.

Hello:

  1. No order errors
  2. No repeat points
  3. When the longitude crosses 180, there will be problems with shape filling

ForTraces avatar Sep 27 '22 03:09 ForTraces

NSDictionary *invecDes = @{ kMaplyDrawPriority: @(kMaplyVectorDrawPriorityDefault), kMaplyFilled:@(YES), kMaplyVecWidth: @(6.0) }; NSArray *points = @[@{@"lon":@"170.883246",@"lat":@"29.263676"}, @{@"lon":@"-172.793431",@"lat":@"28.646870"}, @{@"lon":@"-172.449873",@"lat":@"16.130755"}, @{@"lon":@"172.862239",@"lat":@"15.604583"}, ];

MaplyCoordinate coords[points.count]; for (int i = 0; i < points.count; i++) { NSDictionary *dict = points[i]; coords[i]= MaplyCoordinateMakeWithDegrees([dict[@"lon"] doubleValue],[dict[@"lat"] doubleValue]); } MaplyVectorObject *vec = [[MaplyVectorObject alloc] initWithAreal:coords numCoords:(int)points.count attributes:@{kMaplyColor:[UIColor redColor]}]; [self.baseViewC addVectors:@[vec] desc:invecDes mode:MaplyThreadCurrent];

Version: 2.6.5 The test code is as above, sliding the earth to fill the quad will pass through the earth

ForTraces avatar Sep 27 '22 03:09 ForTraces

Crossing 180 might be a problem, it's true. You could try breaking up the polygon across that boundary.

sjg-wdw avatar Sep 27 '22 15:09 sjg-wdw

图片 图片

Quad After adding the division code, the quad will circle the earth. How does this need to be set up?

ForTraces avatar Sep 28 '22 06:09 ForTraces

I would recommend explicitly clipping your data on that boundary to get better control of the display.

sjg-wdw avatar Sep 28 '22 22:09 sjg-wdw