40楼#
发布于:2004-09-15 08:54
<P>比较鼠标当前点和当前屏幕顶点之间X and Y的差距,到达制定范围后就把移动地图</P><P>车辆监控 『轨迹回放』功能用的很多的</P>
|
|
42楼#
发布于:2004-08-13 16:25
<img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em02.gif" />
|
|
43楼#
发布于:2004-08-03 08:51
<P>下面是简单的绑定X/Y的例子,</P>
<P>Dim BindLayerObject As New MapXLib.BindLayer</P> <P> Dim flds As New MapXLib.Fields Dim conn As New ADODB.Connection Dim rst As New ADODB.Recordset Dim connstring As String Dim sqlstr As String </P> <P> Dim ds As MapXLib.Dataset ' Get the recordset to map</P> <P> ' MapStats Access database</P> <P> ' Has Longitude, Latitude columns</P> <P> connstring = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa" _ ; ";Initial Catalog=数据库名;Data Source=计算机名" conn.Open connstring</P> <P> sqlstr = "select * from US_Cust" rst.CursorLocation = adUseClient rst.Open sqlstr, conn, adOpenStatic, adLockOptimistic</P> <P> rst.MoveLast</P> <P> Debug.Print "Record Set has " ; rst.RecordCount ; " records."</P> <P> ' Fill in the Bindlayer object</P> <P> BindLayerObject.layername = "US Customers" 'Name of new layer</P> <P> BindLayerObject.RefColumn1 = "X" ' "Longitude"</P> <P> ' Use Column number (one'based!) or Column name</P> <P> BindLayerObject.RefColumn2 = "Y" ' "Latitude"</P> <P> BindLayerObject.LayerType = miBindLayerTypeXY BindLayerObject.FileSpec = App.Path ; "\map\US Customers" ; ".tab" 'Type for X/Y binding</P> <P> Debug.Print "Finished setting up Bind Layer" If Dir(App.Path ; "\map\US Customers.*") <> "" Then Kill (App.Path ; "\map\US Customers.*") Set ds = Map1.DataSets.Add(miDataSetADO, rst, "testname", "City", , BindLayerObject)</P> <P> Debug.Print "Finished adding dataset" Dim ftrs As MapXLib.Features</P> <P> rst.Close </P> [此贴子已经被作者于2004-8-4 17:04:16编辑过]
|
|
44楼#
发布于:2004-04-30 18:28
不错!!
<img src="images/post/smile/dvbbs/em01.gif" /> |
|
45楼#
发布于:2004-04-28 13:25
<P>在VB+Mapx5.0中新建图层及属性的源代码
Private Sub Command1_Click() 'this sample used the new AddField methods and the LayerInfo object to </P><P>make a new tab 'file. for each record in the Us_Cust table (found in mapstats.mdb) </P><P>it adds a point 'feature to the new table. for each feature added to the table, </P><P>selected attribute 'data from Us_Cust is associated with that point (the company name, </P><P>order ammount, city 'and state). Dim rs As DAO.Recordset Dim db As DAO.Database Dim flds As New MapXLib.Fields</P><P> Dim lyrNew As MapXLib.Layer Dim ptNew As New MapXLib.Point Dim ftrNew As MapXLib.Feature Dim ff As MapXLib.FeatureFactory Dim li As New MapXLib.LayerInfo Dim rvs As New MapXLib.Rowvalues Dim ds As MapXLib.Dataset 'make database connection and get a recordset Set db = DBEngine.OpenDatabase("C:\Program Files\MapInfo\MapX </P><P>5.0\data\mapstats.mdb") Set rs = db.OpenRecordset("US_Cust") 'we'll use feature factory later</P><P> Set ff = Map1.FeatureFactory 'define the columnar structure of the new table we're going to </P><P>create flds.AddStringField "Company", 50 flds.AddStringField "City", 50 flds.AddStringField "State", 2 flds.AddNumericField "Order_Amt", 12, 2 'define the LayerInfo object li.Type = miLayerInfoTypeNewTable li.AddParameter "FileSpec", App.Path ; "\custtab.tab" li.AddParameter "Name", "mycustomers" li.AddParameter "Fields", flds</P><P> 'add the new layer to the top of the map Map1.Layers.Add li, 1 'make a dataset from the new layer and get its Rowvalues </P><P>collection Set lyrNew = Map1.Layers(1) Set ds = Map1.Datasets.Add(miDataSetLayer, lyrNew) Set rvs = ds.Rowvalues(0) 'for each records in the Us_Cust table we'll make a point feature </P><P>and add it 'to the newly created layer. Using the Rowvalues object from </P><P>that layer's 'dataset we'll supply attribute data for each point feature added</P><P> rs.MoveFirst Do While Not rs.EOF rvs.Item("Company").value = rs.Fields("Company") rvs.Item("City").value = rs.Fields("City") rvs.Item("State").value = rs.Fields("State") rvs.Item("Order_Amt").value = rs.Fields("Order_Amt") ptNew.Set rs.Fields("X"), rs.Fields("Y") Set ftrNew = ff.CreateSymbol(ptNew) Set ftrNew = lyrNew.AddFeature(ftrNew, rvs) rs.MoveNext</P><P> Loop 'close database connection Set rs = Nothing Set db = Nothing End Sub </P> |
|
46楼#
发布于:2004-04-28 13:14
<b>用VB写的创建椭圆区域的原代码
</b>// FeatureFactory.CreateEllipticalRegion Method void CSampleProjectView::CreateEllipse() { // Create a new ellipse region and add it to a temporary features layer CMapXRectangle rect; CMapXFeature createdEllipse; if(!rect.CreateDispatch(rect.GetClsid())) { TRACE0("Failed to Create rectangle object"); return; } try { rect.Set(m_Map.GetCenterX(),m_Map.GetCenterY(),m_Map.GetCenterX()+30,m_Map.GetCenterY()+10); createdEllipse = m_Map.GetFeatureFactory().CreateEllipticalRegion(rect); <P> m_Map.GetLayers().Item("Temp Layer").AddFeature(createdEllipse); } catch(COleDispatchException* e) { e->ReportError(); e->Delete(); } catch(COleException* e) { e->ReportError(); e->Delete(); } }</P> |
|
47楼#
发布于:2004-04-28 13:11
<P><b>MAP控件的水平垂直滚动条</b></P><P>procedure TForm1.Timer1Timer(Sender: TObject);
var xp,yp,xr,yr,w,h:integer; begin //**********µØÍ¼ÊÓÒ°ËæscrollboxµÄ¹ö¶¯Ìõ¸Ä±ä¶ø¸Ä±ä************** if (map1.Top<>0) or (map1.Left<>0) then begin xp:=scrollbox1.HorzScrollBar.Position; yp:=scrollbox1.VertScrollBar.Position; xr:=scrollbox1.HorzScrollBar.Range; yr:=scrollbox1.VertScrollBar.Range; w:=map1.Width; h:=map1.Height; map1.CenterX:=(xp-(xr-w)/2)*(map2.Bounds.XMax-map2.Bounds.XMin)/xr+map2.CenterX; map1.CenterY:=-(yp-(yr-h)/2)*(map2.Bounds.YMax-map2.Bounds.YMin)/yr+map2.CenterY; map1.Top:=0; map1.Left:=0; end; //<<<<<<<***************************************************** end;</P> |
|
48楼#
发布于:2004-04-24 08:26
<P>那位知道为什么我的打包程序建立不了快捷方式啊</P>
|
|
49楼#
发布于:2004-04-15 09:34
hao
|
|