Announcement

Collapse
No announcement yet.

iOS: Unable to create polygon without giving it altitude

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • iOS: Unable to create polygon without giving it altitude

    I am trying to create a renderable layer to display a polygon on a WWBMNGLandsatCombinedLayer. The worldview is created and setup as follows:

    WorldWindView *_wwv;

    - (void) createWorldWindView
    {
    _wwv = [[WorldWindView alloc] initWithFrame:CGRectMake(self.view.bound s.origin.x,
    self.view.bounds.origin.y,
    self.view.bounds.size.width,
    self.view.bounds.size.height)];

    if (_wwv == nil)
    {
    NSLog(@"Unable to create a WorldWindView");
    return;
    }

    [self.view addSubview:_wwv];

    NSDictionary* viewsDictionary = NSDictionaryOfVariableBindings(_wwv);

    [_wwv setTranslatesAutoresizingMaskIntoConstra ints:NO];

    [[self view] addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_wwv]|" options:0 metrics:nil
    views:viewsDictionary]];

    [[self view] addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_wwv]|" options:0
    metrics:nil views:viewsDictionary]];
    }

    ...

    The WWBMNGLandsatCombinedLayer is added as follows:

    WWLayerList* layers = [[_wwv sceneController] layers];

    [layers addLayer:[[WWBMNGLandsatCombinedLayer alloc] init]];

    ...

    The polygon is added as follows:

    NSMutableArray *posArray = [[NSMutableArray alloc] init];

    [posArray addObject:[[WWPosition alloc] initWithCLLocation:[[CLLocation alloc] initWithLatitude:42.0 longitude:-70.0]]];
    [posArray addObject:[[WWPosition alloc] initWithCLLocation:[[CLLocation alloc] initWithLatitude:42.25 longitude:-70.0]]];
    [posArray addObject:[[WWPosition alloc] initWithCLLocation:[[CLLocation alloc] initWithLatitude:42.25 longitude:-71.0]]];
    [posArray addObject:[[WWPosition alloc] initWithCLLocation:[[CLLocation alloc] initWithLatitude:42.0 longitude:-71.0]]];
    [posArray addObject:[[WWPosition alloc] initWithCLLocation:[[CLLocation alloc] initWithLatitude:42.0 longitude:-70.0]]];

    WWPolygon* pShape = [[WWPolygon alloc] initWithPositions: posArray];

    pShape.altitudeMode = WW_ALTITUDE_MODE_CLAMP_TO_GROUND;

    WWShapeAttributes* pShapeAttribs = [[WWShapeAttributes alloc] init];

    [pShapeAttribs setOutlineEnabled:YES];
    [pShapeAttribs setOutlineColor:[[WWColor alloc] initWithUIColor:[UIColor cyanColor]]];
    [pShapeAttribs setOutlineWidth:4.0];
    [pShapeAttribs setInteriorEnabled:YES];
    [pShapeAttribs setInteriorColor:[[WWColor alloc] initWithUIColor:[UIColor magentaColor]]];

    [pShape setAttributes: pShapeAttribs];

    [layer addRenderable: pShape];

    [layers addLayer:layer];

    ...

    Using the debugger, it is confirmed that the WWBMNGLandsatCombinedLayer is first in the layers list and that the renderable layer is second. The WW_ALTITUDE_MODE_CLAMP_TO_GROUND is used to ignore altitude. However, only traces of the polygon's outline is displayed. I have an image file of what it is doing, but was unable to upload it.

    However, if I give the polygon positions with altitude as follows:

    [posArray addObject:[[WWPosition alloc] initWithDegreesLatitude:42.00 longitude:-70 altitude:10000]];
    [posArray addObject:[[WWPosition alloc] initWithDegreesLatitude:42.25 longitude:-70 altitude:10000]];
    [posArray addObject:[[WWPosition alloc] initWithDegreesLatitude:42.25 longitude:-71 altitude:10000]];
    [posArray addObject:[[WWPosition alloc] initWithDegreesLatitude:42.00 longitude:-71 altitude:10000]];
    [posArray addObject:[[WWPosition alloc] initWithDegreesLatitude:42.00 longitude:-70 altitude:10000]];

    WWPolygon* pShape = [[WWPolygon alloc] initWithPositions: posArray];

    //pShape.altitudeMode = WW_ALTITUDE_MODE_CLAMP_TO_GROUND;

    WWShapeAttributes* pShapeAttribs = [[WWShapeAttributes alloc] init];

    [pShapeAttribs setOutlineEnabled:YES];
    [pShapeAttribs setOutlineColor:[[WWColor alloc] initWithUIColor:[UIColor cyanColor]]];
    [pShapeAttribs setOutlineWidth:4.0];
    [pShapeAttribs setInteriorEnabled:YES];
    [pShapeAttribs setInteriorColor:[[WWColor alloc] initWithUIColor:[UIColor magentaColor]]];

    [pShape setAttributes: pShapeAttribs];

    [layer addRenderable: pShape];

    The polygon shows up successfully. I am not sure at what exact value it shows up, I just know I used 100, 1000 and 10000 and 10000 is when it finally looked somewhat correct.

    The problem is that the altitude provided by the input data is 0, which doesn't seem to work.

    Can anyone help or direct me to a solution. Thank you!



    Correction, altitude of 1000 seems to work as well. An altitude of 100 looks like it works, but when one zooms in, the outline of the polygon is just partial and the fill color disappears as one zooms in closer. Less than 100 gives one a partial polygon with some outline and some fill, that disappears as one zooms in.

    I also can provide images of what I am seeing. I tried to upload them, but every attempt failed. The images can be provided upon request.


    WWPath seems to act the same way. Based on magnitude of altitude and zoom level will determine if the path is displayed correctly.
    Last edited by jbmsem; 01-06-2015, 09:21 PM. Reason: Images

  • #2
    What kind of langage is this ??
    I knew my C++ was rusty, but not so much.
    Is it LISB ? (Lot of insipid and stupid brakets)... Just joking, never mind.
    You must know that WWJ (please notice the last letter) is only supported in java.


    Edited : Sorry i did no see this what about iOs version and system/language i don't know anything about. Apologizes !!
    I have the bad habit of clicking just 'What's new' in this forum. Sorry again.

    Welcome to the forum, anyway.

    Btw, in the java version, i raised a problem in the past with the Clamp and the ClampED constant strings (i think it was with KML), but it has probably no relation with your issue.
    Last edited by frenchy; 01-07-2015, 10:52 AM.

    Comment


    • #3
      The question is for World Wind iOS. World Wind iOS is in Objective-C. That is the language that you see above. I posted this question here because it was for iOS development.

      Thank you for any help/guidance that can be given.

      Comment

      Working...
      X