void __fastcall TForm1::Map1MouseMove(TObject *Sender, TShiftState Shift, int X, int Y){CMapXPoint *pt;pt = Map1->ConvertCoordP(OleVariant(X),OleVariant(Y),miMapToScreen);Form1->sStatusBar1->Panels->Items[1]->Text = "X: " + String(pt->X) + " Y: "+ String(pt->Y);}
/*Создать miToolTypePoly, например в OnCreate формы:OleVariant unusedParam;OleVariant unusedParam2;unusedParam.VType=varError;unusedParam.VError=2147614724;unusedParam2=miCrossCursor;Map1->CreateCustomTool(4, (ToolTypeConstants)miToolTypePoly, unusedParam2, unusedParam,unusedParam, unusedParam);*/ //использовать:void __fastcall TForm1::SpeedButton5Click(TObject *Sender){Map1->CurrentTool=4;} void __fastcall TForm1::Map1PolyToolUsed(TObject *Sender, short ToolNum, long Flags, LPDISPATCH Points, VARIANT_BOOL bShift, VARIANT_BOOL bCtrl, VARIANT_BOOL *EnableDefault){if ( ToolNum != 4) return; if (Flags == miPolyToolEnd) { Variant X; X =(Points); CMapXFeature *f; f = Map1->FeatureFactory->CreateLine(X); int d = f->Length; sStatusBar1->Panels->Items[2]->Text = AnsiString("Расстояние: ") + AnsiString(d) + AnsiString(" м"); } }
Variant vLayers = (IDispatch *)Map1->Layers; Variant noparam; noparam.vt = VT_ERROR; noparam.VError = DISP_E_PARAMNOTFOUND; Variant newLayer = vLayers.OleFunction("CreateLayer", "NewLayer",noparam,Variant(1)); newLayer.OlePropertySet("Editable",true); vLayers.OleProcedure("InsertionLayer",newLayer); Map1->CurrentTool = miAddPointTool;
CMapXLayer* newLayer = Map1->Layers->CreateLayer(L"NewLayer",TNoParam(),Variant(1)); newLayer->Editable = true; Variant vLayers = (IDispatch *)Map1->Layers; vLayers.OleProcedure("InsertionLayer",newLayer);
Variant vMap = Map1->DefaultDispatch; Variant vLayers = vMap.OlePropertyGet("Layers"); vLayers.OleProcedure("LayersDlg");
Variant vMap = Map1->DefaultDispatch; Variant vLayers = vMap.OlePropertyGet("Layers"); Variant noparam; noparam.vt = VT_ERROR; noparam.VError = DISP_E_PARAMNOTFOUND; Variant vNewLayer = vLayers.OleFunction("CreateLayer", "NewLayer",noparam,Variant(1)); vNewLayer.OlePropertySet("Editable",true); vLayers.OleProcedure("InsertionLayer",vNewLayer); Map1->CurrentTool = miAddPointTool; // Чтобы проверить...
void __fastcall set_InsertionLayer(Mapxlib_tlb::CMapXLayer* /*[VT_USERDEFINED:1]*/ Value) { _TDispID _dispid(/* InsertionLayer */ DISPID(15)); TAutoArgs1> _args; _args[1] = (LPDISPATCH) /*[VT_DISPATCH:1]*/ (Mapxlib_tlb::CMapXLayer* /*[C2]*/)Value; // OlePropertyPut(_dispid, _args); ---- то что было OleProcedure(_dispid, _args); // -- тор что стало }
CMapXLayer* newLayer = Map1->Layers->CreateLayer(L"NewLayer",TNoParam(),Variant(1)); newLayer->Editable = true; Map1->Layers->InsertionLayer = newLayer;
Mapxlib_tlb::CMapXLayer* /*[VT_USERDEFINED:1]*/ __fastcall get_InsertionLayer() { _TDispID _dispid(/* InsertionLayer */ DISPID(15)); TAutoArgs0> _args;// OlePropertyGet(_dispid, _args); Было OleFunction(_dispid, _args); // Стало return (Mapxlib_tlb::CMapXLayer* /*[C3]*/)(LPDISPATCH)_args.GetRetVariant(); }
AnsiString name = Map1->Layers->InsertionLayer->Name;
Form1.Map1.Layers.Item['datchiki'].GetFeatureByID(1).centerx:=1;
feat:=Form1.map1.Layers.Item['datchiki'].AllFeatures;feat.Item[1].CenterX:=1;feat.Item[1].CenterY:=2;