felix
路人甲
路人甲
  • 注册日期2004-07-10
  • 发帖数14
  • QQ
  • 铜币157枚
  • 威望0点
  • 贡献值0点
  • 银元0个
20楼#
发布于:2004-07-18 12:02
<P>layername := comblytxt.Text;
  application.MessageBox(PCHAR(layername),'',0);
  <a>lyr</A> := currentmap.Layers.Item['street'];
  <a>lyr.Find.RefineLayer</A> := currentmap.Layers.Item['street'];
  foundobj := lyr.Find.Search(findtxt.Text,'');</P><P>在<a>lyr</A> := currentmap.Layers.Item['street']; 这里出现的错误信息是 not enough actual </P><P>parameters?</P><P>怎么解决呢</P>
举报 回复(0) 喜欢(0)     评分
liuqiongliu
路人甲
路人甲
  • 注册日期2004-07-26
  • 发帖数2
  • QQ
  • 铜币115枚
  • 威望0点
  • 贡献值0点
  • 银元0个
21楼#
发布于:2004-07-28 09:38
<P>非常感谢!</P><P>大家有的多发些在,呵呵.</P>
举报 回复(0) 喜欢(0)     评分
千山暮雪
路人甲
路人甲
  • 注册日期2004-06-25
  • 发帖数87
  • QQ
  • 铜币352枚
  • 威望0点
  • 贡献值0点
  • 银元0个
22楼#
发布于:2004-08-04 12:00
<P>动态加载图层,仅供参考!</P><P>procedure TfrmMain.mAddLayerClick(Sender: TObject);
var
  FilterIndex,iCount:Integer;
  sFileName:String;
begin
  iCount:= MapX.Layers.Count+1;
  OpenDialog.InitialDir := sPath;
  OpenDialog.Filter :='图层集合 *.gst|*.gst|MapInfo 图层 *.tab|*.tab';
  OpenDialog.Title := '添加图层';
  if OpenDialog.Execute then
  begin
    FilterIndex := OpenDialog.FilterIndex;
    sFileName := OpenDialog.FileName;
    case FilterIndex of
      1: MapX.Layers.AddGeoSetLayers(sFileName);
      2: MapX.Layers.Add(sFileName,iCount);
    end;
    MapX.Refresh ;
    mFullClick(Sender);
  end;
  SetCurrentDir(sPath);
end;</P>
你来自北京周口, 我来自云南元谋, 我拉着你毛茸茸的小手, 轻轻的咬上一口, 啊, 是爱情让我们直立行走!
举报 回复(0) 喜欢(0)     评分
holy0529
路人甲
路人甲
  • 注册日期2004-08-05
  • 发帖数11
  • QQ
  • 铜币142枚
  • 威望0点
  • 贡献值0点
  • 银元0个
23楼#
发布于:2004-08-09 11:32
<P>iniFile:=TIniFile.Create(ExtractFilePath(Application.ExeName)+'FileTemp\51.ini');
  PtNumber:=iniFile.ReadInteger('消防中队','PtNumber',0);
  pt := CoPoint.Create;
  for i:=1 to PtNumber do
  begin
    StrPtCoordinate:=iniFile.ReadString('消防中队','Pt'+IntToStr(i),'');
    dealStrLocation(StrPtCoordinate,strPtX,strPtY);
    pt.Set_(StrToFloat(strPtX),StrToFloat(strPtY));
    Style:=Map.DefaultStyle;
    Style.SymbolType := miSymbolTypeBitmap;
    Style.SymbolBitmapColor := miColorRed;
    Style.SymbolBitmapSize := 12;
    Style.SymbolBitmapTransparent:=true;
    Style.SymbolBitmapName:='fire1-32.bmp';
    ftr:=Map.FeatureFactory.CreateSymbol(pt,Style);
    Map.Layers.Item('FireTeam').AddFeature(ftr,EmptyParam);
  end;
  iniFile.Free; </P><P>在安装目录,例如:C:\Program Files\MapInfo MapX\Program\CUSTSYMB中加入创建自己的图标。</P><P>在程序中 创建</P><P>CMapXStyle  style;
  
style = m_ctrlMapX.GetDefaultStyle();
style.SetSymbolType(1);  
style.SetSymbolBitmapName("CAR1-32.bmp");
style.SetSymbolBitmapSize(20);    
style.SetSymbolBitmapOverrideColor(0);  
style.SetSymbolBitmapTransparent(1);</P><P>   fNewFeature = m_ctrlMapX.GetFeatureFactory().CreateSymbol();
   //设定符号样式
   fNewFeature.SetStyle(style);
   fNewFeature.GetPoint().Set(dLongtitude,dLatitude);
   //设定标注内容  
   CString  strInfo = " ";
   fNewFeature.SetKeyValue(strInfo);     //设定标注内容
   //将符号加入图层  
   newFeature.m_feature = layer.AddFeature(fNewFeature);
 </P>
举报 回复(0) 喜欢(0)     评分
jffeng_22
路人甲
路人甲
  • 注册日期2004-04-30
  • 发帖数62
  • QQ
  • 铜币265枚
  • 威望0点
  • 贡献值0点
  • 银元0个
24楼#
发布于:2004-08-25 17:40
<P>关于建立公交的网络拓扑关系.txt(转帖)</P><P>建立网络拓扑关系分三步走!
1、数据库部分,建立公交线与公交站点的对应数据库
2、在地图上画出公交线及公交站点,要求尽量的精确
3、通过遍历数据库的公交线及地图,建立一其拓扑关系
比如(A->B->C->D)就可以在数据库表示其拓扑关系:
From To Dist Line
A B 14.00 1
B C 20.98 1
C D 9.00 1 </P><P>
procedure TfrmMain.Button1Click(Sender: TObject);
begin
frmProgress := TfrmProgress.Create(Self);
frmProgress.Show;
frmProgress.Update; </P><P>frmProgress.pbPubTra.Position := 0;
InitPublicTraffic();
frmProgress.pbPubTra.Position := 100; </P><P>frmProgress.Free; </P><P>ShowMessage('公交线路的网络拓扑关系创建完成!');
end; </P><P>procedure TfrmMain.InitPublicTraffic;
var
str: String;
fld: TField;
i,nBus: Integer;
nFromStop,nToStop:Integer;
nStop1,nStop2: Integer;
nOffset: Integer;
lyr: CMapXLayer;
dDist: Double;
ftA,ftB:CMapXFindFeature;
ds: CMapXDataset;
begin
//lyr.Selection.
if not adoConn.Connected then Exit; </P><P>str := 'select * from 公交线路 order by MAPINFO_ID';
adoQueryBus.Connection := adoConn;
adoQueryStop.Connection := adoConn;
adoTableArc.Connection := adoConn;
adoTableArc.TableName := 'NetArcList';
adoTableArc.Open;
adoQueryBus.SQL.Clear;
adoQueryBus.SQL.Add(str);
adoQueryBus.Open; </P><P>adoQueryBus.First;
nOffset := 100 div adoQueryBus.RecordCount; </P><P>lyr := mapPT.Layers._Item('公交站点');
ds := mapPT.Datasets.Add(miDataSetLayer, lyr ,EmptyParam, EmptyParam, EmptyParam, EmptyParam,EmptyParam, EmptyParam);
lyr.Find.FindDataset := ds;
lyr.Find.FindField := ds.Fields.Item[1]; </P><P>while not adoQueryBus.Eof do
begin
fld := adoQueryBus.Fields.FindField('MAPINFO_ID');
nBus := fld.AsInteger;
if nBus = 0 then continue; </P><P>str := Format('StopID%d',[1]);
fld := adoQueryBus.Fields.FindField(str);
nFromStop := fld.AsInteger;
if nFromStop = 0 then continue; </P><P>for i := 2 to 32 do
begin
str := Format('StopID%d',);
fld := adoQueryBus.Fields.FindField(str);
nToStop := fld.AsInteger;
if fld.AsInteger = 0 then break; </P><P>str := Format('select MAPINFO_ID from 公交站点 where CODE=%d',[nFromStop]);
adoQueryStop.Close;
adoQueryStop.Active := False;
adoQueryStop.SQL.Clear;
adoQueryStop.SQL.Add(str);
adoQueryStop.Open; </P><P>nStop1 := adoQueryStop.Fields[0].AsInteger;
str := Format('%d',[nStop1]);
ftA := lyr.Find.Search(str, EmptyParam); </P><P>str := Format('select MAPINFO_ID from 公交站点 where CODE=%d',[nToStop]);
adoQueryStop.Close;
adoQueryStop.Active := False;
adoQueryStop.SQL.Clear;
adoQueryStop.SQL.Add(str);
adoQueryStop.Open; </P><P>nStop2 := adoQueryStop.Fields[0].AsInteger;
str := Format('%d',[nStop2]);
ftB := lyr.Find.Search(str, EmptyParam); </P><P>dDist := mapPT.Distance(ftA.CenterX, ftA.CenterY, ftB.CenterX, ftB.CenterY); </P><P>adoTableArc.Recordset.AddNew(EmptyParam,EmptyParam);
adoTablearc.Recordset.Fields.Item[1].Value := nStop1; //nFromStop - 10000;
adoTablearc.Recordset.Fields.Item[2].Value := nStop2; //nToStop - 10000;
adoTablearc.Recordset.Fields.Item[3].Value := nBus;
adoTablearc.Recordset.Fields.Item[4].Value := dDist; </P><P>nFromStop := nToStop; </P><P>{ str := Format('insert into NetArcList(FromStop,ToStop,LineID) values(%d,%d,%d)',
[nFromStop, nToStop, nBus]);
adoQueryStop.SQL.Clear;
adoQueryStop.SQL.Add(str);
adoQueryStop.Open;
}
end;
frmProgress.pbPubTra.Position := frmProgress.pbPubTra.Position + nOffset;
adoQueryBus.Next;
end;
adoQueryBus.Close;
adoQueryStop.Close;
adoTableArc.Close;
frmProgress.pbPubTra.Position := 5;
end; </P>
举报 回复(0) 喜欢(0)     评分
jffeng_22
路人甲
路人甲
  • 注册日期2004-04-30
  • 发帖数62
  • QQ
  • 铜币265枚
  • 威望0点
  • 贡献值0点
  • 银元0个
25楼#
发布于:2004-08-25 17:41
<P>在MapX中实现图元闪烁(转帖)</P><P>MapX图元分三种类型:
1、线(Line),即miFeatureTypeLine
2、区域(Region),即miFeatureTypeRegion
3、点符号(Symbol),即miFeatureTypeSymbol </P><P>加入一个时钟控件,并在时钟控件中实现以下代码: </P><P>procedure TMapFrm.tmFlashSelectTimer(Sender: TObject);
var
ft: CMapXFindFeature;
lyr: CMapXLayer;
bExist: Boolean;
i: Integer;
str: String;
ds: CMapXDataset;
begin
bExist := False;
for i := 1 to mapCity.Layers.Count do
begin
if mapCity.Layers.Item.Name = m_strSelLyr then
begin
bExist := True;
break;
end;
end; </P><P>if not bExist then
begin
tmFlashSelect.Enabled := False;
MsgFrm := TMsgFrm.Create(Self);
MsgFrm.m_strMsg := Format('图层[%s]信息不存在!',[m_strSelLyr]);
MsgFrm.ShowModal;
MsgFrm.Free;
Exit;
end; </P><P>lyr := mapCity.Layers._Item(m_strSelLyr);
ds := mapCity.Datasets.Add(miDataSetLayer, lyr ,EmptyParam, EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam);
lyr.Find.FindDataset := ds;
lyr.Find.FindField := ds.Fields.Item[1];
str := Format('%d',[m_nSelID]);
ft := lyr.Find.Search(str,EmptyParam); </P><P>if ft.FindRC mod 10 <> 1 then
begin
tmFlashSelect.Enabled := False;
MsgFrm := TMsgFrm.Create(Self);
MsgFrm.m_strMsg := Format('单位点[%s]信息不存在!',[m_strCorpName]);
MsgFrm.ShowModal;
MsgFrm.Free;
Exit;
end; </P><P>case ft.type_ of
miFeatureTypeLine:
begin
if ft.Style.LineColor = miColorWhite then
ft.Style.LineColor := miColorRed
else
ft.Style.LineColor := miColorWhite;
end;
miFeatureTypeRegion:
begin
if ft.Style.RegionColor = miColorGreen then
ft.Style.RegionColor := miColorRed
else
ft.Style.RegionColor := miColorGreen;
end;
miFeatureTypeSymbol:
begin
if not m_bFlashSel then
lyr.Selection.Replace(ft)
else
lyr.Selection.ClearSelection;
m_bFlashSel := not m_bFlashSel;
end;
end;
ft.Update(EmptyParam, EmptyParam); </P><P>if not m_bCenter then
begin
m_bCenter := True;
mapCity.CenterX := ft.CenterX;
mapCity.CenterY := ft.CenterY;
mapCity.Refresh;
end;
end; </P><P>我这里是把选中的图元实现闪烁,并把图元居中 </P>
举报 回复(0) 喜欢(0)     评分
jffeng_22
路人甲
路人甲
  • 注册日期2004-04-30
  • 发帖数62
  • QQ
  • 铜币265枚
  • 威望0点
  • 贡献值0点
  • 银元0个
26楼#
发布于:2004-08-25 17:43
mapx中如何创建缓冲区 (转帖)
内容:  Private Sub cmdBuffer_Click()
'** buffer the selection from the Top 20 Cities table
Dim ftrnew As New Feature
Dim ftr As Feature
'Something from the Top 20 Cities table must be selected for this to work
For Each ftr In Map1.Layers("US Top 20 Cities").Selection
   Set ftrnew = Map1.FeatureFactory.BufferFeatures(ftr, 250)  'Create a 250 mile buffer feature
   Map1.Layers.Item("Temp").AddFeature ftrnew  'add the new buffer to the map
Next
End Sub
 
举报 回复(0) 喜欢(0)     评分
jffeng_22
路人甲
路人甲
  • 注册日期2004-04-30
  • 发帖数62
  • QQ
  • 铜币265枚
  • 威望0点
  • 贡献值0点
  • 银元0个
27楼#
发布于:2004-08-25 17:43
<P>MapX在Delphi中,如何找出线等Feature的结点(转)</P><P>obj : Variant ; // MapXLib_TLB.Feature;</P><P>arrVals: Variant; //leee 030621
idx,NodeCnt:integer;
NodeString:String;
以下代码响应MapX控件的ToolUsed事件
Case ToolNum of
CUSTOM_POINT_TOOL :
………;
CUSTOM_LINE_TOOL :
………;
………;
miSelectTool :
begin
if (ctrl) then
ftrLayer.Selection.SelectByPoint(X1, Y1, miSelectionAppend)
else if (Shift) then
ftrLayer.Selection.SelectByPoint(X1, Y1, miSelectionRemove)
else then
ftrLayer.Selection.SelectByPoint(X1, Y1, miSelectionNew);</P><P>if (ftrLayer.selection.count >= 1) //0306 lee 设计
then begin
obj:=ftrLayer.Selection.Item(ftrLayer.selection.count); //此处示例取得最后一个Feature ,也可用循环语句取得所有Feature
arrVals := obj.Nodes;</P><P>{</P><P>NodeCnt:=arrVals[1,1]);
NodeString:='';
for idx:=1 to NodeCnt do
NodeString:=#13+#10+NodeString+IntToStr(idx)+' 经度:'+FloatToStr(arrVals[idx*2,1])+' 纬度:'+FloatToStr(arrVals[idx*2+1,1]);</P><P>showMessage('共'+FloatToStr(arrVals[1,1])+'结点,它们的座标为:'+NodeString); //+'---'
end;
ShowMessage(IntToStr(ftrLayer.selection.count)+'个对象被选择!');
end;
end;//Case</P>
举报 回复(0) 喜欢(0)     评分
dlwang
路人甲
路人甲
  • 注册日期2004-08-30
  • 发帖数3
  • QQ
  • 铜币111枚
  • 威望0点
  • 贡献值0点
  • 银元0个
28楼#
发布于:2004-08-30 21:05
请问一下,怎样在dephi 中做出象AutoCAD中的那样能够通过三点画圆弧
举报 回复(0) 喜欢(0)     评分
dlwang
路人甲
路人甲
  • 注册日期2004-08-30
  • 发帖数3
  • QQ
  • 铜币111枚
  • 威望0点
  • 贡献值0点
  • 银元0个
29楼#
发布于:2004-08-30 21:06
请问一下,怎样在dephi 中做出象AutoCAD中的那样能够通过三点画圆弧
举报 回复(0) 喜欢(0)     评分
游客

返回顶部