Select to view content in your preferred language

PictureMarkerSymbol problems

3442
14
09-29-2020 12:48 PM
BrianCrist
Emerging Contributor

I have a graphic that is being updated at a regular interval (15-20hz) that I would really like to use a KML overlay for, but cannot since updating KML Overlays doesn't work in 2d maps.  (Prior Conversation on GeoNet)

So I've been using a PictureMarkerSymbol with some success, but I am now observing some weirdness with it.  I'm wondering if it's something I am doing wrong or if I've stumbled on another bug.

The basic workflow is the sensor (a sonar) that we're tracking feeds us a stream of QImages.  I scale the QImage to the appropriate size according to our current zoom level and map scaling and create a PictureMarkerSymbol using this code block:

Esri::ArcGISRuntime::Graphic m_graphic;          // declared elsewhere
Esri::ArcGISRuntime::GraphicsOverlay m_overlay;  // Set up elsewhere
Esri::ArcGISRuntime::Point point;                // Set up elsewhere

Esri::ArcGISRuntime::PictureMarkerSymbol pms(scaled_image,this);
pms.setAngle(m_heading);
pms.setWidth(scaled_image.width());
pms.setHeight(scaled_image.height());

if (m_graphic.isNull())
{
  m_graphic = new Esri::ArcGISRuntime::Graphic(point, &pms);
  m_overlay->graphics()->append(m_graphic);
}
else
{
  m_graphic.data()->setSymbol(&pms);
  m_graphic.data()->setGeometry(point);
}

The functionality is great to an extent.  But when the image exceeds a certain size (in this case, 20 meters), the PictureMarkerSymbol seems to unexpectedly change its shape as demonstrated in the 3 images I have attached.  The first image shows a sonar at range of 16 meters, the second a range of 19 meters; you can see the aspect ratio of the image/PictureMarkerSymbol (dim red rectangle with the sonar fan in the front of it) is a distinct rectangle.

When the range reaches 20 meters, the aspect ratio of the image / PictureMarkerSymbol changes into a square!!  I know this is not in the QImage scaling code, as I've stepped through and observed the QImage itself scaling properly.  The "change" happens within the PictureMarkerSymbol.

Please advise.

Regards,

  Brian

0 Kudos
14 Replies
JamesBallard1
Esri Regular Contributor

Brian Crist‌,

   Sounds like there are a few things going on here. Before we diagnose the issues you're seeing with PictureMarkerSymbol, let me point you towards our sample demonstrating the ImageOverlay.

arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/Scenes/AnimateImagesWithImageOverlay at mast... 

What you're describing sounds like the ideal use case for an ImageOverlay. Please take a look at our sample code, which shows how to use this workflow with png images and QImage.

0 Kudos
BrianCrist
Emerging Contributor

Hi James,

  I would love, love, love to use an ImageOverlay, but we are using a Map / GraphicsMapView (2d) architecture for our application for several reasons, and ImageOverlay does not operate on those.  

 

Regards,

  Brian

0 Kudos
JamesBallard1
Esri Regular Contributor

Brian Crist‌, oh dang, sorry for the bogus recommendation.

I or someone on the team will look into your issues with picture marker symbol when we get a spare minute.

0 Kudos
BrianCrist
Emerging Contributor

Awesome, thank you.  I am continuing to research here as well and I will post if I figure anything out.

Regards,

  Brian

0 Kudos
LucasDanzinger
Esri Frequent Contributor

When the aspect ratio changes, what is the width and height that is being reported on the picture marker symbol?

0 Kudos
BrianCrist
Emerging Contributor

So that's an interesting thing actually.  You can see in the code above that I've got it set to the width and height of the scaled image - but before I put those calls in there, the width and height would report 0 at all times!

I'm trying several things right now on my end to make this work, but I feel like there's a key element I may have missed reporting above.  It should be noted that in the code above, the overlay is set to setScaleSymbols of TRUE and the map has a reference scale.  If this itself presents a problem please let me know.  

0 Kudos
LucasDanzinger
Esri Frequent Contributor

after you call setWidth and setHeight, do you get back square or rectangle dimensions? 

can you try setting the graphics rendering mode on the graphics overlay explicitly to dynamic and explicitly to static? I'm curious if either of these gives differing results.

0 Kudos
BrianCrist
Emerging Contributor

Calling setWidth and setHeight makes no difference to the appearance - I will double check what it does to the reported sizes and get back to you.

I'll also set the rendering mode explicitly and let you know.

Thanks!

  Brian

0 Kudos
BrianCrist
Emerging Contributor

So the height() and width() calls reflect what I set the values to with setHeight() and setWidth().

I also verified that the height and width values are 0 if I do not set them.

Setting the rendering mode made no difference in either case.

I also have noticed that when you go from "big" to "little" it leaves detritus on the screen.  

Could this be happening because the PictureMarkerSymbol is a local (stack) variable? Should I make it static?  Or should I make it a class member?  It doesn't seem like you can "update" the imagery in a PictureMarkerSymbol, so I don't know if we can do that...

0 Kudos