FEATURE for MapX in C ++ Builder

xiaoxiao2021-03-06  67

I tried a day of Feature yesterday, and now there is a problem: 1) Caped cmapx *** DISP to tagvariant, such as examples of example, create lines and areas, whether you are writing any of the following, you create unsuccessful , Map1-> Layers -> _ item (variant (1)) -> CreateRegion (PointS, EmptyParam); // Compiling Failed Map1-> Layers -> _ Item (Variant (1)) -> CreateRegion (Variant (iUnknown *) Points, EMPTYPARAM; // Running Creating Uncomfortable Should be Write as: Map1-> Layers -> _ Item (Variant (1)) -> CreateRegion (Variant (CMAPXPoints *) Points, EMPTYPARAM); // Work creation Successful and I have to use the following two lines of code: feature = map1-> FeatureFactory-> CreateRegion (EMPTYPARAM, EMPTYPARAM); Feature-> Parts-> Add (Points); 2) The following example retains an error, that is When the code below creates Feature, the program exits will throw an exception. Now I haven't found a solution, but I have to use other methods, such as the method used in CreateRegion cmapxfeatureSp line; line.bind ("Mapx.Feature.5"); line.attach (map1-> oleobject) ; 3) Text Display cannot be displayed on the layer (resolved) :. Change the original Variant ("text chart")) is OK (WideString)), but if there is Chinese, Without the four bytes behind, only "Text" is displayed. Sample code: void __fastcall tfrmfeature :: map1mouseup (TOBJECT * Sender, TMouseButton Button, TshiftState Shift, int X, int y) {// only plus the figures IF in the animation layer ((Button! = Mbleft) || (PlacefeatureID = = -1)) Return; IF (Map1-> Layers-> count == 0) {log ("log", "there is no layer or animation layer, can not complete the add feature"); PlaceFeatureID = -1; Return;} // Action Name String Strformation; cmapxpointDisp Point; // generated element cMapxfeature * feature = NULL;

Point.bind (StringToolestr ("Mapx.Point.5")); Point = Map1-> ConvertCoRDP (Variant (x), Variant (Y), MiscreeNAp);

Switch (PlacefeatureID) {Case 0: {CMapxPointDisp P1; CMapXpointDisp P2; P1.Bind (StringToolestr ("Mapx.Point.5"); p2.bind (StringToolestr ("Mapx.Point.5")); p1.set_ (Point.Get_x () -1.0, point.get_y () 0.2); p2.set_ (Point.get_x () 0.4, Point.GET_Y () -0.4); feature = map1-> FeatureFactory-> Createarc (P1 , P2, EMPTYPARAM, EMPTYPARAM, EMPTYPARAM, EMPTYPARAM : {feature = Map1-> FeatureFactory-> CreateCircularRegion (miCircleTypeMap, point, Variant (30), EmptyParam, Variant (99), EmptyParam); Map1-> Layers -> _ Item (Variant (1)) -> AddFeature (feature, EMPTYPARAM; strfeature = "like circular area";} Break; case 2: {// Do this Line.attach (Map1-> oleObject); line.type = mifeatureTypeline; line.style = map1-> defaultStyle; cMapxpointsdis P P Points; Points.bind (StringToolestr ("Mapx.Points.5")); Double X = Point.get_x (); Double Y = Point.get_y (); Points.Addxy (x - 1, y - 0.5); Points.addxy (x - 0.5, y 0.5); Points.Addxy (x, y); Points.addxy (x 0.5, y - 0.5); Points.Addxy (x 1, y 0.5); line. Parts-> Add (Points);

// featureFactory-> CreateLine (EmptyParam, EmptyParam); Map1-> Layers -> _ Item (Variant (1)) -> AddFeature (Line, EmptyParam); line-> attach (null); strfeature = " Line, exit, abnormally, please use the method of adding zones ";} Break; case 3: {cMapxpointsdisp Points; Points.bind (StringToolestr (" Mapx.Points.5 "); double x = point.get_x (); double y = point.get_y (); points.addxy (x - 1, y - 0.5); Points.adDXY (x - 0.2, y 0.7); Points.Addxy (x 0.3, y - 0.1); Points.Addxy (x 0.8, y 0.6); feature = map1-> FeatureFactory-> CreateRegion (EmptyParam, EmptyParam); Feature-> Parts-> Add (Points); Map1-> Layers -> _ item (Variant (1)) - > AddFeature (feature, EmptyParam); strFeature = "region element";} break; case 4: {feature = Map1-> FeatureFactory-> CreateSymbol (EmptyParam, EmptyParam); feature-> set_Point (point); Map1-> Layers -> _ item (variant (1)) -> addfeature (feature, emptyparam); strfeature = "point map element";} Break; case 5: {variant caption = text Element abcdefg "; caption.ChangeType (0x8); feature = Map1-> FeatureFactory-> CreateText (EmptyParam, caption, EmptyParam, EmptyParam); feature-> set_Point (point); Map1-> Layers -> _ Item (Variant (1 ) -> addfeature (feature, emptyparam); strformed = "text chair";

Default:; ("Log", Strfeature "Location x:" String (Point.get_x ()) "Y:" String (Point.get_Y ()) (Feature == NULL? "Faile": "secc"));

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

New Post(0)