MapX map drawn from the database (b)

  MapX map drawn from the database (b) 

  Subject: MapX Delphi database map Layer Style Font 

  I am in the April 15, 2004 published an article "Drawing from the database MapX map", I received a lot of letters from readers, as busy, not to respond, and here express sincere apologies!    I only said that the article grateful for the support of Yinli brothers and sisters, thank you. 

  Here is a more efficient MapX map drawn from the database approach, I established a database of data sheets are as follows: 

  Table Name: Xunit 

  ID: string / / unique identifier for each graphic element, it can also be a number of types of 

  NAME: string / / graphic element name 

  X: Float / / graphic element abscissa 

  Y: Float / / graphic element Ordinate 

  Code list: 

  / / AqXUnit is a TADOQuery, which SQL statements as "SELECT * FROM XUNIT." 

  Procedure TfrmMain.DrawLayerFromDB; 

  Var 

  OBLayer: BindLayer; 

  SearchLayer: Layer; 

  Ds: Dataset; 

  Begin 

  / / Use this process must ensure that aqXUnit table has been opened! 

  If not aqXUnit.Active then 

  Begin 

  GiveMsg ( 'table does not open system based on custom tips !');// call method 

  Exit; 

  End; 

  / / Create BindLayer, hate-British semi-Han, no way, no translation ^ _ ^ 

  OBLayer: = coBindLayer.Create; 

  OBLayer.LayerName: = 'ARTEMIS'; 

  OBLayer.LayerType: = miBindLayerTypeXY; / / use this parameter must be bundled XY coordinates 

  OBLayer.RefColumn1: = 'X'; / / The first parameter must be designated as the abscissa 

  OBLayer.RefColumn2: = 'Y'; / / Ordinate 

  / / Add data sets 

  Ds: = mapMain.Datasets.Add (12, / / types of data sets, this is miDataSetADO, that is dedicated ADO 

  AqXUnit.Recordset, / / use this method was the ADO Recordset type _ 

  'DS_SK' / / data set name 

  'ID', / / Xunit table is imported in the name ID field 

EmptyParam,

  OBLayer, / / BindLayer 

EmptyParam,

EmptyParam);

  / / Will be set up on the new layer below the attributes 

  SearchLayer: = mapMain.Layers.Item ( 'ARTEMIS'); 

  / / Font color 

  SearchLayer.LabelProperties.Style.TextFontColor: = miColorPurple; 

  SearchLayer.LabelProperties.Style.TextFontHalo: = true; 

  SearchLayer.LabelProperties.Style.TextFontBackColor: = miColorWhite; 

  / / Set the label shown in Figure yuan 

  SearchLayer.LabelProperties.Dataset: = ds; 

  SearchLayer.LabelProperties.DataField: = ds.Fields.Item ( 'NAME'); 

  SearchLayer.LabelProperties.LabelZoom: = true; 

  / / Set scaling of the layers 

  SearchLayer.ZoomMin: = 0; 

  SearchLayer.ZoomMax: = 200; 

  SearchLayer.ZoomLayer: = true; 

  / / Set scaling of the labels 

  SearchLayer.LabelProperties.LabelZoomMin: = 0; 

  SearchLayer.LabelProperties.LabelZoomMax: = 200; 

  SearchLayer.LabelProperties.LabelZoom: = true; 

  / / Automatic graphs yuan 

  SearchLayer.AutoLabel: = true; 

  End; 

  This method than the above-mentioned methods should be a lot faster, You ~ ~ 

  Yangyutian YangYutian@Hotmail.Com 

  July 13, 2004 

Bookmark it: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Google
  • DotNetKicks
  • DZone
  • Furl
  • Netvouz

Releated Articles

  • Popuklar Articles

0 Comments to “MapX map drawn from the database (b)”

No Comments. Send your comment.

Leave a Reply

You must be logged in to post a comment.