TatukGIS menu

Knowledge Base





KB10342 - Add a pie-piece shaped object to map layer.

There are two options for creating pie-piece shaped (or any other shaped) objects in a DK application:

1) Draw this on your own by rendering the pie-piece shape using a series of lines, like this:

shp->Lock() ;
shp->Reset() ;
shp->AddPoint( GisPoint() )
shp->AddPoint( GisPoint() )
shp->Unlock()

2) Override OnPaintShape event (See samples #1 BitmapFill)

ll->OnPaintShape = PaintShape ;

void __fastcall TForm1::PaintShape( const TObject *_sender, const TGIS_Shape
*_shape )
{
  TPoint pt ;
  pt = GIS->ScreenToMap( _shape.Centroid ) ; // so we know the postion

  // how to convert map units (distance) to screen units
  screen_distance = map_distance * GIS->Zoom ;

  // and now you will know how to draw Pie using Canvas   _shape->Layer->Viewer->Canvas->Pie( ... ) ;

}
Created: November 21, 2003, Modified: August 03, 2015