mousebird-consulting-inc / WhirlyGlobe

WhirlyGlobe Development
Other
830 stars 255 forks source link

v2.6.5 issue with displaying addVectors #1544

Closed ForTraces closed 6 months ago

ForTraces commented 2 years ago

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

图片
sjg-wdw commented 2 years ago

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

ForTraces commented 2 years ago

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

图片
sjg-wdw commented 2 years ago

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:

ForTraces commented 2 years ago

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 commented 2 years ago

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

sjg-wdw commented 2 years ago

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

ForTraces commented 2 years ago
图片 图片

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

sjg-wdw commented 2 years ago

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