地理信息?
我做了个程序是要在地图上显示汽车,其中汽车是bmp文件。但是出来的是一个7。请问高手怎么修改?
procedure TForm1.Map1ToolUsed(ASender: TObject; ToolNum: Smallint; X1, Y1,
X2, Y2, Distance: Double; Shift, Ctrl: WordBool;
var EnableDefault: WordBool);
Var
s : variant;
Pnt : cmapxPoint; //点
FeaFac :cmapxFeatureFactory; //地图图元
Lyr : cmapxLayer; //图层
Ftr : cmapxFeature ; //图元对象
NewStyle : cmapxStyle ; //点对象的样式符号
Nothing:variant;
begin
s :=CreateOleObject('MapX.Point.4');
s:=map1.Layers.CreateLayer('temp',emptyparam,emptyparam,emptyparam,emptyparam);
Lyr:=Map1.Layers.Item('temp'); // 新建图层
Lyr.Style.SupportsBitmapSymbols;
Lyr.Style.SymbolBitmapOverrideColor;
FeaFac:=map1.featurefactory; //土元
NewStyle:=Lyr.Style;
//NewStyle.SupportsBitmapSymbols;
// NewStyle.SymbolBitmapOverrideColor;
With NewStyle do
begin
SymbolType:=miSymbolTypeBitmap; //SymbolType是如何显示点图元(以图)
SymbolBitmapSize:= 24 ;
SymbolBitmapTransparent:= False ;
SymbolBitmapName:='F:\应用mapx\导入bmp文件\GiftService.bmp';
end;
map1.AutoRedraw:=False; //禁止自动刷新
Lyr.Editable:=True;//置当前图层为可写状态
pnt := CoPoint.Create;
pnt.Set_(x1,y1);
//Lyr.SearchAtPoint(s,emptyparam); //'创建点对象
//'添加进当前图层
Ftr:=FeaFac.CreateSymbol(Pnt,Newstyle);
Ftr:=FeaFac. CreateSymbol (Pnt,map1.DefaultStyle);
Lyr.AddFeature(Ftr,EmptyParam);
Lyr.Refresh;
Map1.AutoRedraw:=True;
Lyr.Editable:=False;
end;
另我也做了一个别的程序也是显示汽车的
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, MapXLib_TLB, StdCtrls;
type
TForm1 = class(TForm)
Map1: TMap;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
procedure car;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var
dxpos,dypos:double;
{$R *.dfm}
{ TForm1 }
procedure TForm1.car;
var
G_CarLayer:MapXLib_TLB.layer;
fMapSymbol:MapXLib_TLB.Feature;
fNewSymbol:MapXLib_TLB.Feature;
begin
dxpos:= Map1.CenterX;
dypos:= Map1.CenterY;
G_CarLayer:=Map1.Layers.CreateLayer('temp',emptyparam,emptyparam,emptyparam,emptyparam);
G_CarLayer.Style.SupportsBitmapSymbols;
G_CarLayer.Style.SymbolBitmapOverrideColor;
Map1.Layers.AnimationLayer:=G_CarLayer;
fNewSymbol.Attach(map1);
With Map1.DefaultStyle do
begin
// SymbolFont: = 'custom symbols';
SymbolType :=1;
SymbolBitmapName :='TEMP1-32.BMP';
SymbolBitmapSize:= 24;
SymbolBitmapTransparent := True;
end;
fNewSymbol.Type_:=miFeatureTypeSymbol;
fNewSymbol.Style:=Map1.DefaultStyle;
fNewSymbol.Point.Set_(dxpos, dypos) ;
fMapSymbol:=G_CarLayer.AddFeature(fNewSymbol,emptyparam);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
car;
end;
end.其中一直说fNewSymbol.Attach(map1);有问题,请问怎么解决啊?