Knowledge Base



KB10482 - Build an in-memory layer and change colors in Visual C++.

An important consideration is to perform the proper casting. The source code to do this:

IXGIS_LayerVector ll ;
IXGIS_ShapePoint shp ;
IXGIS_Utils utl ;
IXGIS_ParamsSectionVector prm ;
IXGIS_ParamsMarker prmmrk ;

utl.CreateDispatch( "TatukGIS_DK.XGIS_Utils" ) ;

ll.CreateDispatch( "TatukGIS_DK.XGIS_LayerVector" ) ;
gis.Add( ll ) ;

// layer defaults
( ( (IXGIS_ParamsMarker)( (IXGIS_ParamsSectionVector)ll.get_Params() ).get_Marker() ) ).put_Color( RGB(0,255,255 ) ) ;

shp = ll.CreateShape( gis.XgisShapeTypePoint ) ;
shp.AddPart() ;
shp.AddPoint( utl.GisPoint( 0, 0 ) ) ;
( ( (IXGIS_ParamsMarker)( (IXGIS_ParamsSectionVector)shp.get_Params() ).get_Marker() ) ).put_Color( RGB(255,0,255 ) ) ;

shp = ll.CreateShape( gis.XgisShapeTypePoint ) ;
shp.AddPart() ;
shp.AddPoint( utl.GisPoint( 1, 1 ) ) ;
( ( (IXGIS_ParamsMarker)( (IXGIS_ParamsSectionVector)shp.get_Params() ).get_Marker() ) ).put_Color( RGB(0,255,0 ) ) ;

shp = ll.CreateShape( gis.XgisShapeTypePoint ) ;
shp.AddPart() ;
shp.AddPoint( utl.GisPoint( 2, 2 ) ) ;
// comment out so layer default will be used
// ( (IXGIS_ParamsMarker)( (IXGIS_ParamsSectionVector)shp.get_Params() ).get_Marker() ) ).put_Color( RGB(0,0,255 ) ) ;

gis.FullExtent() ;
 
Created: December 14, 2004, Modified: August 28, 2015