C ++ Builder App Mapx experience

xiaoxiao2021-03-06  71

It is not a class name for the class and VC used in C Builder. They are all self-contained by tools, under the $ cbuilder $ / imports directory or under the working path of the VC.

BCB automatically generates a file in installation of OCX, and VC is generated with [Project] -> [Add to Project] -> [Components and Controls], if Map5, it will be a lot of files.

Of course, you can also ($ MAPX $ / Samples 50 / C / CPP) example, the Mapx.cpp file, but is an example below for VC . And the generated class name is different from the class name of the imported file generated by the VC. Plus CC before the VC generated

BCB usually adds DISP later. The above is to start learning to develop MAPX with CB, copy the C sample code directly, compile, the virtual class cannot generate an error such as an instance.

Such as:

For interface cmapxfeatures, in the example, the class name is in the same, and the class instance generated in the VC is called CCMapxfeature, which is CMapxFeatureDisp in C Builder.

Below is two examples of CB (5 is the version number of MAPX):

Example 1:

CMAPXStyledisp style;

Style.bind (StringToolestr ("Mapx.Style.5");

Style.PickRegion ();

For (int I = 1; i <= map1-> layers-> get_count (); i ) {

Map1-> Layers -> _ Item (Variant (i)) -> set_style (style);

}

Example 2:

CMapxfeature * fnewsymbol;

CMapxfeature * fmapsymbol;

CMapxPointDisp Pt;

CMAPXStyledisp style;

IF (Toolnum == PLOT_VEHICLE_TOOL)

{

Pt.bind (StringToolestr ("Mapx.Point.5"));

Pt-> set_ (x1, y1);

Style.bind (StringToolestr ("Mapx.Style.5");

STYLE = Map1-> defaultStyle;

FneWSymbol = NULL;

FneWSymbol = Map1-> FeatureFactory-> CreateSyMbol (EmptyParam, EmptyParam);

IF (FneWSymbol! = null)

{

FneWSymbol-> set_point (pt);

FneWSymbol-> set_style (style);

IF (lyrmylayer! = null)

{

FMapsyMbol = lyrmylayer-> addfeature (fnewsymbol);

IF (FMapsymbol! = NULL)

{

Farray [IVEHICLECOUNT] .ffeature = fmapsymbol;

Farray [IveHicleCount] .ispeed = 0;

Farray [IVEHICLECOUNT] .dHeading = 0;

Farray [IvehicleCount]. Sname = "Vehicle" INTOSTR (IVEHICLECOUNT);

IVEHICLECUNT ;

UpdatelistCars ();

}

}

}

}

转载请注明原文地址:https://www.9cbs.com/read-92258.html

New Post(0)