Select to view content in your preferred language

graphics with height / extruded graphics, #2

956
2
Jump to solution
06-06-2017 12:41 AM
NorbertThoden
Frequent Contributor

I would like to create a cube on a GraphicsOverlay using 4 points for the lower z-values (base/ground) and 4 points for the upper z-values.

The z-values of each point may differ... (The reason to avoid a renderer as used in the former thread: graphics with height / extruded graphics)

Can someone point me to an adequate example or have other hints?

Thanks in advance.

Norbert

0 Kudos
1 Solution

Accepted Solutions
NorbertThoden
Frequent Contributor

Hi Luke!

This approach seems to be painful to implement.

comparing the reuqirements and the possible solutions we choose the UniqueValueRenderer to create cubes of different heights and different colors nested into each other.

So we hope that every floor of a building can be marked with a single color (as suggested by Eric)

Thanks a lot!

Norbert

View solution in original post

0 Kudos
2 Replies
LukeSmallwood
Esri Contributor

Hi Norbert,

If you are trying to draw a cuboid which has irregular z values and don't think that extrusion will work, another option could just be to draw a series of vertical polygons for the faces of the shape. Here's some example code that draws the sides of a 3d shape with some variation in the z values. Note you could probably do this in a more elegant fashion using a multi part polygon.

  SimpleLineSymbol* outlineSym = new SimpleLineSymbol(SimpleLineSymbolStyle::Solid, Qt::black, 4, this);
  SimpleFillSymbol* fillSym = new SimpleFillSymbol(SimpleFillSymbolStyle::Solid, Qt::red, outlineSym, this);
  PolygonBuilder* bldr = new PolygonBuilder(m_sceneView->spatialReference(), this);
  bldr->addPoint(Point(0., 0., 40000));
  bldr->addPoint(Point(0., 1., 50000));
  bldr->addPoint(Point(0., 1., 100000));
  bldr->addPoint(Point(0., 0., 100000));
  Graphic* g1 = new Graphic(bldr->toPolygon(), fillSym, this);
  PolygonBuilder* bldr2 = new PolygonBuilder(m_sceneView->spatialReference(), this);
  bldr2->addPoint(Point(0., 1., 50000));
  bldr2->addPoint(Point(1., 1., 50000));
  bldr2->addPoint(Point(1., 1., 100000));
  bldr2->addPoint(Point(0., 1., 100000));
  Graphic* g2 = new Graphic(bldr2->toPolygon(), fillSym, this);
  PolygonBuilder* bldr3 = new PolygonBuilder(m_sceneView->spatialReference(), this);
  bldr3->addPoint(Point(1., 1., 50000));
  bldr3->addPoint(Point(1., 0., 50000));
  bldr3->addPoint(Point(1., 0., 100000));
  bldr3->addPoint(Point(1., 1., 100000));
  Graphic* g3 = new Graphic(bldr3->toPolygon(), fillSym, this);
  PolygonBuilder* bldr4 = new PolygonBuilder(m_sceneView->spatialReference(), this);
  bldr4->addPoint(Point(1., 0., 50000));
  bldr4->addPoint(Point(0., 0., 40000));
  bldr4->addPoint(Point(0., 0., 100000));
  bldr4->addPoint(Point(1., 0., 100000));
  Graphic* g4 = new Graphic(bldr4->toPolygon(), fillSym, this);
  m_overlay->graphics()->append(g1);
  m_overlay->graphics()->append(g2);
  m_overlay->graphics()->append(g3);
  m_overlay->graphics()->append(g4);

Does that help with your problem?

Luke

0 Kudos
NorbertThoden
Frequent Contributor

Hi Luke!

This approach seems to be painful to implement.

comparing the reuqirements and the possible solutions we choose the UniqueValueRenderer to create cubes of different heights and different colors nested into each other.

So we hope that every floor of a building can be marked with a single color (as suggested by Eric)

Thanks a lot!

Norbert

0 Kudos