484
MapX Reference Guide MapInfo Corporation Troy, NY

Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Embed Size (px)

Citation preview

Page 1: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

MapX

Reference Guide

MapInfo CorporationTroy, NY

Page 2: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Information in this document is subject to change without notice and does not represent a commitment on the part of the vendor or its representatives. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying without the written permission of MapInfo Corporation, One Global View, Troy, New York 12180–8399.

©1992–1999 MapInfo Corporation. ALL RIGHTS RESERVED.

MapInfo Help ©1992–1999 MapInfo Corporation. ALL RIGHTS RESERVED.

MapInfo, MapInfo Professional, MapBasic, MapXtreme and the MapInfo Logo are registered trademarks of MapInfo Corpora-tion.

Contact MapInfo Corporation on the Internet at: http://www.mapinfo.com

WARNING: This software uses patented LZW technology for .GIF image compression and/or decompression. (Unisys United States patent No. 4,558,302 and corresponding patents in Canada, France, Germany, Italy, Japan and the United Kingdom). GIF images compressed or decompressed for transmission via the Internet or via any other on–line communication capability may not be sold or licensed for revenue, or used by an Internet Service Provider or in paid advertisements unless the user first enters into a written license agreement with Unisys. For information concerning licensing, please contact: Unisys Corporation Welch Licensing Department C1SW19 Township Line & Union Meeting Roads P.O. Box 500 Blue Bell PA 19424 Fax: 215–986–3090

HAHTsite is a registered trademark of HAHT Software Inc. in the United States.

Portions of the data are the proprietary information of Roadnet Technologies, Inc., a United Parcel Service Company, and are Copyright 1993. Roadnet Technologies, Inc.

Monotype and Century Gothic are trademarks of Monotype Topography Limited registered in the U.S. Patent and Trademark Office and certain other jurisdictions.

Portions of this publication are Copyright 1998, HAHT Software Inc. All Rights Reserved.

Portions of the software are derived from the Standard C Library, ©copyright 1992, by P.J. Plauger, published by Prentice–Hall, and are used with permission.

HyperHelp copyright© Bristol Technology Inc. 1991, 1992, 1993

HIL© Media Cybernetics, Inc. 1993, Halo Imaginf Library is a trademark of Media Cybernetics, Inc.

EHelp® is a registered trademark of Foundation Solutions, Inc., ©copyright, 1992, 1993.

MrSID® is a trademark of LizardTech, Inc. and is used under license.Products named herein may be trademarks of their respective manufacturers and are hereby recognized. Trademarked names are used editorially, to the benefit of the trademark owner, with no intent to infringe on the trademark.This documentation reflects the contributions of almost all of the women and men who work for MapInfo Corporation. It was specifically produced by Tony Maritato and Max Morton , with the help of Jim Regan, David Smith, Brian Bloniarz, and Larry Strianese. Colleen Cox, Editor. These members of the Documentation Department are indebted to MapInfo’s Quality Assurance Department and, of course, to all the members of the Engineering team who labored on this project.

MapInfo welcomes your comments and suggestions.

MapX v4.0September 1999

MapInfo Corporate Headquarters: MapInfo Europe Headquarters:

Voice: (518) 285–6000 England Germany

Fax: (518) 285–6060 voice: +44 (0)1753 848 229 voice: +49 6196 6700 0

Sales Info Hotline: (800) 327–8627 fax: +44 (0)1753 621 140 fax: +49 6196 6700 11

Federal Sales: (800) 619–2333

Technical Support Hotline: (518) 285–7283Technical Support Fax: (518) 285–6080 For international customers, please use the Technical Support Fax number.

Page 3: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Table of Contents

AffineTransform object . . . . . . . . . . 1AffineTransform.A, B, C, D, E, F properties

(AffineTransform object). . . . . . . . . . . . . . . . . 1AffineTransform.Set method (AffineTransform

object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2AffineTransform.Units property (Affine

Transform object) . . . . . . . . . . . . . . . . . . . . . . 2

Annotation object and Annotations

collection . . . . . . . . . . . . . . . . . . 3Annotation.Graphic property (Annotation

object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Annotation.Type property (Annotation object)

5Annotations.ActiveAnnotation method

(Annotations collection) . . . . . . . . . . . . . . . . . 5Annotations.AddSymbol method

(Annotations collection) . . . . . . . . . . . . . . . . . 5Annotations.AddText method (Annotations

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Annotations.Count property (Annotations

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Annotations.Editable property (Annotations

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Annotations.Item property (Annotations

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Annotations.Remove method (Annotations

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Annotations.RemoveAll method (Annotations

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

BindLayer object . . . . . . . . . . . . . . 11BindLayer.CoordSys property (BindLayer

object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13BindLayer.Filespec property (BindLayer object)

13BindLayer.KeyLength property (BindLayer

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13BindLayer.LayerName property (BindLayer

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14BindLayer.LayerType property (BindLayer

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14BindLayer.RefColumn1 property (BindLayer

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15BindLayer.RefColumn2 property (BindLayer

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15BindLayer.ReferenceLayer property

(BindLayer object) . . . . . . . . . . . . . . . . . . . . 16BindLayer.ReferenceLayerField property

(BindLayer object) . . . . . . . . . . . . . . . . . . . . 18

BitmapSymbol object and

BitmapSymbols collection. . . . 19BitmapSymbol.Name property (BitmapSymbol

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22BitmapSymbols.Count property

(BitmapSymbols collection) . . . . . . . . . . . . 22BitmapSymbols.Item property

(BitmapSymbols collection) . . . . . . . . . . . 22BitmapSymbols.Refresh method

(BitmapSymbols collection) . . . . . . . . . . . . 23BitmapSymbols.Unload method

(BitmapSymbols collection) . . . . . . . . . . . . 23

CoordSys object . . . . . . . . . . . . . . 25CoordSys.AffineTransform property

(CoordSys object) . . . . . . . . . . . . . . . . . . . . . 25CoordSys.Azimuth property (CoordSys object)

25CoordSys.Bounds property (CoordSys object).

26CoordSys.Clone method (CoordSys object) . 26CoordSys.Datum property (CoordSys object)26CoordSys.FalseEasting, FalseNorthing

properties (CoordSys object) . . . . . . . . . . . 26

Page 4: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Table of Contents

CoordSys.OriginLatitude, OriginLongitude properties (CoordSys object) . . . . . . . . . . . . 26

CoordSys.PickCoordSys method (CoordSys object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

CoordSys.Range property (CoordSys object) 27CoordSys.ScaleFactor property (CoordSys

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27CoordSys.Set method (CoordSys object) . . . . 28CoordSys.StandardParallelOne,

StandardParallelTwo properties (CoordSys object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

CoordSys.Type property (CoordSys object) . 29CoordSys.Units property (CoordSys object) . 29

DataSet object and DataSets

collection . . . . . . . . . . . . . . . . . 31DataSet.AddField method (DataSet object) . 34Datasets.BuildSourceRows property (Datasets

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35DataSet.Fields property (DataSet object) . . . . 35DataSet.GeoField property (DataSet object) . 35DataSet.Layer property (DataSet object) . . . . 35DataSet.Name property (DataSet object) . . . . 36DataSet.Refresh method (DataSet object) . . . 37Dataset.RowValues method (Dataset object) 37DataSet.RowCount property (DataSet object)38Dataset.ReadOnly property (Dataset object) . 38DataSets.Restore method (DataSets collection)

38DataSet.SecondaryGeoField property (DataSet

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39DataSet.SourceRows property (DataSet object)

39DataSet.Themes property (DataSet object) . . 39DataSet.Type property (Dataset object) . . . . . 40DataSet.Value method (DataSet object) . . . . . 40DataSets.Add method (DataSets collection). 43DataSets.Count property (DataSets collection).

50DataSets.Item property (DataSets collection) 51DataSets.Remove method (DataSets collection)

51DataSets.RemoveAll method (DataSets

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

Datum object . . . . . . . . . . . . . . . . . .55Datum.Eccentricity property (Datum object) 55Datum.Ellipsoid property (Datum object) . . . 55Datum.Flattening property (Datum object) . . 56Datum.PrimeMeridian property (Datum object)

56Datum.RotateX, RotateY, RotateZ properties

(Datum object) . . . . . . . . . . . . . . . . . . . . . . . . 56Datum.ScaleAdjust property (Datum object) 56Datum.SemiMajorAxis, SemiMinorAxis

properties (Datum object). . . . . . . . . . . . . . . 57Datum.Set method (Datum object) . . . . . . . . . 57Datum.SetFromList method (Datum object) . 58Datum.ShiftX, ShiftY, ShiftZ properties (Datum

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

Feature object and Features collection

59Feature.Area property (Feature object) . . . . . 61Feature.Attach method (Feature object) . . . . . 61Feature.Clone method (Feature object) . . . . . 63Feature.Bounds property (Feature object) . . . 63Feature.Caption property (Feature object). . . 64Feature.CenterX property, CenterY property

(Feature object). . . . . . . . . . . . . . . . . . . . . . . . 66Feature.FeatureID property (Feature object) . 66Feature.FeatureKey property (Feature object). .

66Feature.KeyValue property (Feature object) . 67Feature.LabelPoint property (Feature object) 69Feature.Layer property (Feature object) . . . . . 69Feature.Length property (Feature object). . . . 70Feature.Name property (Feature object) . . . . 71Feature.Nodes property (Feature object) . . . . 72Feature.Offset method (Feature object) . . . . . 74Feature.Parts property (Feature object) . . . . . 74Feature.Perimeter property (Feature object) 74Feature.Point property (Feature object) . . . . . 75Feature.Smooth property (Feature object) . . . 75Feature.Style property (Feature object) . . . . . 75Feature.Type property (Feature object) . . . . . 75Feature.Update method (Feature object) . . . . 76Features.Add method (Features collection). . 79Features.AddByID method (Features

i i MapX Reference

Page 5: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Table of Contents

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80Features.Bounds property (Features collection)

80Features.Clone method (Features collection) .81Features.Common method (Features

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81Features.Count property (Features collection) .

82Features.Item property (Features collection) .83Features.Remove method (Features collection).

83Features.RemoveByID method (Features

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84Features.Replace method (Features collection) .

84

FeatureFactory object . . . . . . . . . . 85FeatureFactory.BufferFeatures method

(FeatureFactory object) . . . . . . . . . . . . . . . . . 86FeatureFactory.CombineFeatures method

(FeatureFactory object) . . . . . . . . . . . . . . . . . 88FeatureFactory.CreateArc method

(FeatureFactory object) . . . . . . . . . . . . . . . . . 89FeatureFactory.CreateCircularRegion method

(FeatureFactory object) . . . . . . . . . . . . . . . . . 91FeatureFactory.CreateEllipticalRegion method

(FeatureFactory object) . . . . . . . . . . . . . . . . . 92FeatureFactory.CreateLine method

(FeatureFactory object) . . . . . . . . . . . . . . . . . 94FeatureFactory.CreateRegion method

(FeatureFactory object) . . . . . . . . . . . . . . . . . 94FeatureFactory.CreateSymbol method

(FeatureFactory object) . . . . . . . . . . . . . . . . . 95FeatureFactory.CreateText method

(FeatureFactory object) . . . . . . . . . . . . . . . . . 95FeatureFactory.EraseFeature method

(FeatureFactory object) . . . . . . . . . . . . . . . . . 96FeatureFactory.IntersectFeatures method

(FeatureFactory object) . . . . . . . . . . . . . . . . . 99FeatureFactory.IntersectionPoints method

(FeatureFactory object) . . . . . . . . . . . . . . . . 100FeatureFactory.IntersectionTest method

(FeatureFactory object) . . . . . . . . . . . . . . . . 100

Field object and Fields collection .

103Field.AggregationFunction property (Field

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103Field.Name property (Field object) . . . . . . . 104Field.Type property (Field object) . . . . . . . . 104Fields.Add method (Fields collection). . . . . 104Fields.Count property (Fields collection) . . 106Fields.Item property (Fields collection). . . . 106Fields.Remove method (Fields collection) . 107Fields.RemoveAll method (Fields collection). .

109

Find object . . . . . . . . . . . . . . . . . . . 111Find.Abbreviations property (Find object) 115Find.CloseMatchMax property (Find object) . .

115Find.ClosestAddress property (Find object) . .

115Find.FindDataset property (Find object) . . 115Find.FindField property (Find object) . . . . 115Find.SearchEx method (Find object) . . . . . . 116Find.OtherBoundary property (Find object) . .

118Find.RefineDataset property (Find object). 118Find.RefineField property (Find object) . . . 118Find.RefineLayer property (Find object) . . 118Find.Search method (Find object) . . . . . . . . 119

FindFeature object . . . . . . . . . . . . 121FindFeature.FindRC property (FindFeature

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

FindMatch object and FindMatches

collection . . . . . . . . . . . . . . . . 123FindMatch.Name property (FindMatch object)

123FindMatch.FeatureID property (FindMatch

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123FindMatch.Score property (FindMatch object)

123

Mapx Referenc i i i

Page 6: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Table of Contents

FindMatches.Count property (FindMatches collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

FindMatches.Item property (FindMatches collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

FindResult object . . . . . . . . . . . 125FindResult.AddressOutOfRange property

(FindResult object) . . . . . . . . . . . . . . . . . . . 125FindResult.ExactMatch property (FindResult

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125FindResult.FindRC property (FindResult

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125FindResult.IntersectionNotFound property

(FindResult object) . . . . . . . . . . . . . . . . . . . 126FindResult.MatchedFeature property

(FindResult object) . . . . . . . . . . . . . . . . . . . 126FindResult.Matches property (FindResult

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126FindResult.MultipleMatches property

(FindResult object) . . . . . . . . . . . . . . . . . . . 126FindResult.RefineRegion property (FindResult

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126FindResult.Substitute property (FindResult

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

Geoset object and Geosets collection

127Geoset.Centroid property (Geoset object). . 127Geoset.PathName property (Geoset object) 127Geoset.UserName property (Geoset object) 128Geosets.Count property (Geosets collection) . .

128Geosets.Item property (Geosets collection) 128

Graphic object . . . . . . . . . . . . . 129Graphic.Caption property (Graphic object) 129Graphic.Position property (Graphic object) 129Graphic.Style property (Graphic object) . . . 130Graphic.X property (Graphic object) . . . . . . 130Graphic.Y property (Graphic object) . . . . . . 130

IndividualValueCategory object and

IndividualValueCategories

collection . . . . . . . . . . . . . . . . .131IndividualValueCategories.AllOthersCategory

property (IndividualValueCategories collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 131

IndividualValueCategories.Count property (IndividualValueCategories collection) . . 132

IndividualValueCategories.Item property (IndividualValueCategories collection) . . 132

IndividualValueCategory.NumItems property (IndividualValueCategories collection) . . 133

IndividualValueCategory.Style property (IndividualValueCategories collection) . . 133

IndividualValueCategory.Value property (IndividualValueCategory object). . . . . . . 133

LabelProperties object . . . . . . . .135LabelProperties.DataField property

(LabelProperties object) . . . . . . . . . . . . . . . 136LabelProperties.DataSet property

(LabelProperties object) . . . . . . . . . . . . . . . 138LabelProperties.Duplicate property

(LabelProperties object) . . . . . . . . . . . . . . . 138LabelProperties.LabelMax property

(LabelProperties object) . . . . . . . . . . . . . . . 138LabelProperties.LabelZoom property

(LabelProperties object) . . . . . . . . . . . . . . . 138LabelProperties.LabelZoomMax property

(LabelProperties object) . . . . . . . . . . . . . . . 139LabelProperties.LabelZoomMin property

(LabelProperties object) . . . . . . . . . . . . . . . 139LabelProperties.LineType property

(LabelProperties object) . . . . . . . . . . . . . . . 139LabelProperties.Offset property

(LabelProperties object) . . . . . . . . . . . . . . . 140LabelProperties.Overlap property

(LabelProperties object) . . . . . . . . . . . . . . . 140LabelProperties.Parallel property

(LabelProperties object) . . . . . . . . . . . . . . . 140LabelProperties.PartialSegments property

(LabelProperties object) . . . . . . . . . . . . . . . 140LabelProperties.Position property

(LabelProperties object) . . . . . . . . . . . . . . . 140LabelProperties.Style property

iv MapX Reference

Page 7: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Table of Contents

(LabelProperties object). . . . . . . . . . . . . . . . 141LabelProperties.Visible property

(LabelProperties object). . . . . . . . . . . . . . . . 141

Layer object and Layers collection

143Layer.AddFeature method (Layer object) . .145Layer.AllFeatures method (Layer object) . .148Layer.BeginAccess method (Layer object). .149Layer.ClearCustomLabels method (Layer

object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150Layer.Editable property (Layer object) . . . .150Layer.EndAccess method (Layer object). . . .150Layer.Search method (Layer object) . . . . . . .151Layer.AutoLabel property (Layer object) . .151Layer.Bounds property (Layer object) . . . . .151Layer.CoordSys property (Layer object) . . .152Layer.DataSets property (Layer object) . . . .153Layer.DeleteFeature method (Layer object) 153Layer.DrawLabelsAfter property (Layer

object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154Layer.DrilldownAddFeatures method (Layer

object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154Layer.DrilldownRemoveFeatures method

(Layer object) . . . . . . . . . . . . . . . . . . . . . . . . 155Layer.DrilldownReset method (Layer object). .

155Layer.FeatureIDFromFeatureName method

(Layer object) . . . . . . . . . . . . . . . . . . . . . . . . 156Layer.FeatureKeyFromFeatureName method

(Layer object) . . . . . . . . . . . . . . . . . . . . . . . . 156Layer.FileSpec property (Layer object) . . . .157Layer.Find property (Layer object) . . . . . . . .157Layer.GetDrilldownFeaturesByID method

(Layer object) . . . . . . . . . . . . . . . . . . . . . . . . 157Layer.GetFeatureByID method (Layer object) .

157Layer.GetFeatureByKey method (Layer object)

158Layer.Invalidate method (Layer object). . . .158Layer.KeyField property (Layer object) . . . .159Layer.LabelAtPoint method (Layer object) .159Layer.LabelProperties property (Layer object) .

161

Layer.Name property (Layer object) . . . . . 161Layer.NoFeatures method (Layer object). . 161Layer.OverrideStyle property (Layer object). .

162Layer.PredominantFeatureType property

(Layer object). . . . . . . . . . . . . . . . . . . . . . . . 162Layer.Refresh method (Layer object). . . . . . 162Layer.SearchAtPoint method (Layer object)163Layer.SearchWithinDistance method (Layer

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164Layer.SearchWithinFeature method (Layer

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167Layer.SearchWithinRectangle method (Layer

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168Layer.Selectable property (Layer object) . . 169Layer.Selection property (Layer object) . . . 169Layer.ShowNodes property (Layer object). 169Layer.ShowCentroids property (Layer object).

169Layer.ShowLineDirection property (Layer

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169Layer.Style property (Layer object). . . . . . . 170Layer.Type property (Layer object) . . . . . . 170Layer.UpdateFeature method (Layer object). .

172Layer.Visible property (Layer object) . . . . . 172Layer.ZoomLayer property (Layer object) . 173Layer.ZoomMax property (Layer object) . . 173Layer.ZoomMin property (Layer object) . . 173Layers.Add method (Layers collection) . . . 174Layers.AddGeosetLayers method (Layers

collection). . . . . . . . . . . . . . . . . . . . . . . . . . . 174Layers.AddServerLayer method (Layers

collection). . . . . . . . . . . . . . . . . . . . . . . . . . . 175Layers.AddUserDrawLayer method (Layers

collection). . . . . . . . . . . . . . . . . . . . . . . . . . . 176Layers.AnimationLayer property (Layers

collection). . . . . . . . . . . . . . . . . . . . . . . . . . . 177Layers.Bounds property (Layers collection)178Layers.ClearSelection method (Layers

collection). . . . . . . . . . . . . . . . . . . . . . . . . . . 179Layers.Count property (Layers collection) . 179Layers.CreateLayer method (Layers collection)

179Layers.InsertionLayer (Layers object) . . . . . 180Layers.Item property (Layers collection) . . 181

Mapx Referenc v

Page 8: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Table of Contents

Layers.LayersDlg method (Layers collection). . 181

Layers.Move method (Layers collection) . . 183Layers. Remove method (Layers collection)184Layers.RemoveAll method (Layers collection)

184

LayerInfo object . . . . . . . . . . . . . . 187LayerInfo.Type property (LayerInfo object) 189LayerInfo.AddParameter method (LayerInfo

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

Legend object . . . . . . . . . . . . . . 191Legend.BodyTextStyle property (Legend

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192Legend.Compact property (Legend object) 192Legend.CompactTitle property (Legend object)

192Legend.CompactTitleStyle property (Legend

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192Legend.CurrencyFormat property (Legend

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192Legend.ExportLegend method (Legend object)

193Legend.Height property (Legend object) . . 193Legend.Left property (Legend object) . . . . . 193Legend.LegendDlg method (Legend object) . .

194Legend.LegendTexts property (Legend object)

195Legend.PaperHeight property (Legend object)

195Legend.PaperWidth property (Legend object)

195Legend.PrintLegend method (Legend object) .

196Legend.ShowCount property (Legend object) .

198Legend.ShowEmptyRanges property (Legend

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199Legend.SubTitle property (Legend object) . 199Legend.SubTitleStyle property (Legend object)

199Legend.Title property (Legend object) . . . . 199

Legend.TitleStyle property (Legend object) 199Legend.Top property (Legend object) . . . . . 200Legend.Visible property (Legend object) . . 200Legend.Width property (Legend object) . . . 200

LegendText object and LegendTexts

collection . . . . . . . . . . . . . . .203LegendTexts.AllOthersText property

(LegendTexts collection). . . . . . . . . . . . . . . 203LegendText.Text property (LegendText object)

204LegendText.Visible property (LegendText

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206LegendTexts.AutoGenerate property

(LegendTexts collection). . . . . . . . . . . . . . . 207LegendTexts.Count property (LegendTexts

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 207LegendTexts.Item property (LegendTexts

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

Map object . . . . . . . . . . . . . . . . . .209Map.AboutBox method (Map object) . . . . . 211Map.Annotations property (Map object) . . . 211Map.AreaUnit property (Map object) . . . . . 211Map.AutoRedraw property (Map object) . . 211Map.BackColor property (Map object) . . . . 213Map.Bounds property (Map object) . . . . . . . 213Map.CenterX property (Map object) . . . . . . 214Map.CenterY property (Map object) . . . . . . 214Map.ClipLine method (Map object) . . . . . . . 215Map.CliplineV method (Map object) . . . . . . 216Map.ConvertCoord method (Map object). . 217Map.ConvertCoordV method (Map object) 219Map.CreateCustomTool method (Map object).

221Map.CurrentTool property (Map object) . . 224Map.DataSet property (Map object). . . . . . . 225Map.DataSetGeoField property (Map object). .

225Map.DataSets property (Map object) . . . . . . 226Map.DataSetTheme property (Map object). 226Map.DefaultConversionResolution property

(Map object) . . . . . . . . . . . . . . . . . . . . . . . . . 226

vi MapX Reference

Page 9: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Table of Contents

Map.DefaultStyle property (Map object) . . .227Map.DisplayCoordSys property (Map object) .

228Map.Distance method (Map object) . . . . . . .229Map.ExportMap method (Map object). . . . .230Map.ExportSelection property (Map object) 232Map.FeatureFactory property (Map object) 233Map.GeoDictionary property (Map object) .233Map.GeoSet property (Map object) . . . . . . .234Map.GeoSets property (Map object). . . . . . .235Map.GeoSetWidth property (Map object) . .235Map.hWnd property (Map object) . . . . . . . .236Map.InfotipSupport property (Map object) .236Map.InfotipPopupDelay property (Map object)

236Map.IsPointVisible method (Map object) . .237Map.Layers property (Map object) . . . . . . . .237Map.MapUnit property (Map object) . . . . .237Map.MapPaperHeight property (Map object) .

239Map.MapPaperWidth property (Map object) . .

239Map.MapScreenHeight property (Map object).

239Map.MapScreenWidth property (Map object) .

240Map.MatchNumericFields property (Map

object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241Map.MatchThreshhold property (Map Object) .

241Map.MaxSearchTime property (Map object) . .

241Map.MouseIcon property (Map object) . . . .241Map.MousePointer property (Map object) .242Map.MouseWheelSupport property (Map

object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243Map.NumericCoordSys property (Map object .

243Map.Pan method (Map object) . . . . . . . . . . . .243Map.PanAnimationLayer (Map object) . . . .244Map.PaperUnit property (Map object). . . . .244Map.PreferCompactLegends property (Map

object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244Map.PrintMap method (Map object) . . . . . .245Map.PropertyPage method (Map object). . .247Map.RedrawInterval property (Map object) . . .

247Map.Refresh method (Map object) . . . . . . . 248Map.Rotation property (Map object) . . . . . 249Map.SaveMapAsGeoset method (Map object)

249Map.SearchPath property (Map object) . . . 250Map.SelectionStyle property (Map object). 251Map.SetSize method (Map object). . . . . . . . 251Map.Title property (Map object) . . . . . . . . . 252Map.TitleText property (Map object) . . . . . 252Map.Version property (Map object) . . . . . . 252Map.WaitCursorEnabled property (Map

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252Map.Zoom property (Map object). . . . . . . . 253Map.ZoomTo method (Map object) . . . . . . 253

MultivarCategory object and

MultivarCategories collection 255MultivarCategories.Count property

(MultivarCategories collection) . . . . . . . . 257MultivarCategories.Item property

(MultivarCategories collection) . . . . . . . . 257MultivarCategory.Style property

(MultivarCategory object) . . . . . . . . . . . . . 257

NotesQueryInfo object . . . . . . . . . 259NotesQueryInfo.BeginDate property

(NotesQueryInfo object) . . . . . . . . . . . . . . 259NotesQueryInfo.Database property

(NotesQueryInfo object) . . . . . . . . . . . . . . 259NotesQueryInfo.DefaultNumericValue

property (NotesQueryInfo object) . . . . . . 260NotesQueryInfo.DefaultStringValue property

(NotesQueryInfo object) . . . . . . . . . . . . . . 260NotesQueryInfo.EndDate property

(NotesQueryInfo object) . . . . . . . . . . . . . . 260NotesQueryInfo.FullTextSearch property

(NotesQueryInfo object) . . . . . . . . . . . . . . 260NotesQueryInfo.MaxNumDocs property

(NotesQueryInfo object) . . . . . . . . . . . . . . 261NotesQueryInfo.Query property

(NotesQueryInfo object) . . . . . . . . . . . . . . 261NotesQueryInfo.Server property

Mapx Referenc v i i

Page 10: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Table of Contents

(NotesQueryInfo object). . . . . . . . . . . . . . . 261

NotesViewInfo object . . . . . . . . . . 263NotesViewInfo.Database property

(NotesViewInfo object). . . . . . . . . . . . . . . . 263NotesViewInfo.Server (NotesViewInfo object).

263NotesViewInfo.View (NotesViewInfo object). .

263

ODBCQueryInfo object . . . . . . . . 265ODBCQueryInfo.ConnectString property

(ODBCQueryInfo object) . . . . . . . . . . . . . . 267ODBCQueryInfo.DataSource property

(ODBCQueryInfo object) . . . . . . . . . . . . . . 270ODBCQueryInfo.SqlQuery property

(ODBCQueryInfo object) . . . . . . . . . . . . . . 270

Parts collection . . . . . . . . . . . . . . 271Parts.Add method (Parts collection). . . . . . 273Parts.Count property (Parts collection). . . . 273Parts.Item property (Parts collection) . . . . . 273Parts.Remove method (Parts collection) . . . 273Parts.RemoveAll method (Parts collection) 274

Point object and Points collection .

277Point.Offset method (Point object). . . . . . . . 279Point.Set method (Point object) . . . . . . . . . . 279Point.X property (Point object) . . . . . . . . . . 280Point.Y property (Point object) . . . . . . . . . . . 280Points.Add method (Points collection) . . . . 280Points.AddXY method (Points collection) . 283Points.Count property (Points collection). . 283Points.Item property (Points collection). . . . 283Points.Remove method (Points collection) . 283Points.RemoveAll method (Points collection) .

284

RangeCategory object and

RangeCategories collection . .287RangeCategories.AllOthersCategory property

(RangeCategories collection) . . . . . . . . . . . 288RangeCategories.Count property

(RangeCategories collection) . . . . . . . . . . . 289RangeCategories.Item property

(RangeCategories collection) . . . . . . . . . . . 289RangeCategory.Max property (RangeCategory

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290RangeCategory.Min property (RangeCategory

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290RangeCategory.NumItems property

(RangeCategory object). . . . . . . . . . . . . . . . 291RangeCategory.Style property

(RangeCategory object). . . . . . . . . . . . . . . . 291

Rectangle object . . . . . . . . . . . . .293Rectangle.Height property (Rectangle object) .

293Rectangle.Offset method (Rectangle object) 293Rectangle.Set method (Rectangle object). . . 294Rectangle.Width property (Rectangle object) . .

294Rectangle.XMax property (Rectangle object) . .

294Rectangle.XMin property (Rectangle object) . .

295Rectangle.YMax property (Rectangle object) . .

295Rectangle.YMin property (Rectangle object) . .

295

ResolveObject object and

ResolveObjects collection . . .297ResolveObject.TableName property

(ResolveObject object) . . . . . . . . . . . . . . . . . 297ResolveObject.SourceMatch (ResolveObject

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297ResolveObject.TableMatch (ResolveObject

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297ResolveObjects.Count property

(ResolveObjects collection). . . . . . . . . . . . . 298ResolveObjects.Item property (ResolveObjects

vi i i MapX Reference

Page 11: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Table of Contents

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 298

RowValue object and RowValues

collection. . . . . . . . . . . . . . . . . 299RowValue.ReadOnly property (RowValue

object). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300RowValue.Dataset property (RowValue object)

300RowValue.Field property (RowValue object) . .

300RowValue.Value property (RowValue object). .

300RowValues.Count property (RowValues

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 301RowValues.ReadOnly property (RowValues

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 301RowValues.Item property (RowValues

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 301RowValues.Remove method (RowValues

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 301RowValues.Add method (RowValues

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 302RowValues.RemoveAll method (RowValues

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 302RowValues.Clone method (RowValues object) .

303

Selection collection . . . . . . . . . . 305Selection.Add method (Selection collection). . .

306Selection.ClearSelection method (Selection

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 308Selection.Clone method (Selection collection) .

308Selection.Common method (Selection

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 308Selection.Remove method (Selection collection)

309Selection.Replace method (Selection collection)

309Selection.SelectAll method(Selection collection)

310Selection.SelectByID method (Selection

collection). . . . . . . . . . . . . . . . . . . . . . . . . . . 310Selection.SelectByPoint method (Selection

collection). . . . . . . . . . . . . . . . . . . . . . . . . . . 311Selection.SelectByRadius method (Selection

collection). . . . . . . . . . . . . . . . . . . . . . . . . . . 312Selection.SelectByRectangle method (Selection

collection). . . . . . . . . . . . . . . . . . . . . . . . . . . 313Selection.SelectByRegion method (Selection

collection). . . . . . . . . . . . . . . . . . . . . . . . . . . 314

SourceRow object and SourceRows

collection . . . . . . . . . . . . . . . . 317SourceRow.Row property (SourceRow object)

317SourceRows.Count property (SourceRows

collection). . . . . . . . . . . . . . . . . . . . . . . . . . . 317SourceRows.Item property (SourceRows

collection). . . . . . . . . . . . . . . . . . . . . . . . . . . 317

Style object . . . . . . . . . . . . . . . . . 321Style.Clone method (Style object) . . . . . . . . 322Style.DrawLineSample method (Style object) .

324Style.DrawRegionSample method (Style

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325Style.DrawSymbolSample method (Style

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327Style.DrawTextSample method (Style object) .

329Style.ExportLineSample method (Style object)

331Style.ExportRegionSample method (Style

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332Style.ExportSymbolSample method (Style

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333Style.ExportTextSample method (Style object)

334Style.LineColor property (Style object) . . . 335Style.LineInterleaved property (Style object) .

335Style.LineStyle property (Style object) . . . . 337Style.LineStyleCount property (Style object). .

338

Mapx Referenc ix

Page 12: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Table of Contents

Style.LineSupportsInterleave property (Style object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338

Style.LineWidth property (Style object) . . . 338Style.LineWidthUnit property (Style object) . .

338Style.PickLine method (Style object) . . . . . . 339Style.PickRegion method (Style object). . . . 339Style.PickSymbol method (Style object) . . . 339Style.PickText method (Style object) . . . . . . 339Style.RegionBackColor property (Style object)

340Style.RegionBorderColor property (Style

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340Style.RegionBorderStyle property (Style object)

340Style.RegionBorderWidth property (Style

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340Style.RegionBorderWidthUnit property (Style

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340Style.RegionColor property (Style object). . 341Style.RegionPattern property (Style object) 341Style.RegionTransparent property (Style

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341Style.SupportsBitmapSymbols property (Style

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342Style.SymbolBitmapColor property (Style

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342Style.SymbolBitmapName property (Style

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342Style.SymbolBitmapOverrideColor property

(Style object) . . . . . . . . . . . . . . . . . . . . . . . . . 343Style.SymbolBitmapSize property (Style object)

343Style.SymbolBitmapTransparent property

(Style object) . . . . . . . . . . . . . . . . . . . . . . . . . 344Style.SymbolCharacter property (Style object)

344Style.SymbolFont property (Style object) . . 344Style.SymbolFontBackColor property (Style

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345Style.SymbolFontColor property (Style object)

345Style.SymbolFontHalo property (Style object).

345Style.SymbolFontOpaque property (Style

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345

Style.SymbolFontRotation property (Style object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346

Style.SymbolFontShadow property (Style object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346

Style.MinVectorSymbolCharacter property (Style object) . . . . . . . . . . . . . . . . . . . . . . . . . 346

Style.MaxVectorSymbolCharacter property (Style object) . . . . . . . . . . . . . . . . . . . . . . . . . 346

Style.SymbolVectorColor property (Style object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347

Style.SymbolVectorSize property (Style object)347

Style.TextFont property (Style object) . . . . . 347Style.TextFontAllCaps property (Style object) .

347Style.TextFontBackColor property (Style

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347Style.TextFontColor property (Style object) 348Style.TextFontDblSpace property (Style object)

348Style.TextFontHalo property (Style object) . 348Style.TextFontOpaque property (Style object) .

348Style.TextFontShadow property (Style object) .

348Style.TextFontRotation property (Style object)

348Style.SymbolType property (Style object) . . 349

Theme object and Themes collection

351Theme.AutoReCompute property (Theme

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351Theme.ComputeTheme property (Theme

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352Theme.DataMax property (Theme object) . 352Theme.DataMin property (Theme object). . 353Theme.Fields property (Theme object) . . . . 353Theme.Layer property (Theme object) . . . . 353Theme.Legend property (Theme object) . . . 353Theme.Name property (Theme object) . . . . 354Theme.ThemeDlg method (Theme object) . 354Theme.ThemeProperties property (Theme

object) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355

x MapX Reference

Page 13: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Table of Contents

Theme.Type property (Theme object) . . . . .356Theme.Visible property (Theme object). . . .356Themes.Add method (Themes collection). .356Themes.Count property (Themes collection) . .

360Themes.Item property (Themes collection).360Themes.Remove method (Themes collection) .

361Themes.RemoveAll method (Themes

collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

ThemeProperties object . . . . . . 363ThemeProperties.AllowEmptyRanges property

(ThemeProperties object) . . . . . . . . . . . . . .364ThemeProperties.DataValue property

(ThemeProperties object) . . . . . . . . . . . . . .364ThemeProperties.DistMethod property

(ThemeProperties object) . . . . . . . . . . . . . .365ThemeProperties.DotSize property

(ThemeProperties object) . . . . . . . . . . . . . .365ThemeProperties.Graduated property

(ThemeProperties object) . . . . . . . . . . . . . .365ThemeProperties.Independent property

(ThemeProperties object) . . . . . . . . . . . . . .366ThemeProperties.IndividualValueCategories

property (ThemeProperties object). . . . . .366ThemeProperties.MultivarCategories property

(ThemeProperties object) . . . . . . . . . . . . . .366ThemeProperties.NumRanges property

(ThemeProperties object) . . . . . . . . . . . . . .367ThemeProperties.RangeCategories property

(ThemeProperties object) . . . . . . . . . . . . . .367ThemeProperties.Size property

(ThemeProperties object) . . . . . . . . . . . . . .367ThemeProperties.SpreadBy property

(ThemeProperties object) . . . . . . . . . . . . . .367ThemeProperties.SymbolStyle property

(ThemeProperties object) . . . . . . . . . . . . . .368ThemeProperties.ValuePerDot property

(ThemeProperties object) . . . . . . . . . . . . . .368ThemeProperties.Width property

(ThemeProperties object) . . . . . . . . . . . . . .368ThemeProperties.PieClockwise property

(ThemeProperties object) . . . . . . . . . . . . . .368ThemeProperties.PieStartAngle property

(ThemeProperties object). . . . . . . . . . . . . . 369ThemeProperties.PieHalfPies property

(ThemeProperties object). . . . . . . . . . . . . . 369ThemeProperties.PieGraduated property

(ThemeProperties object). . . . . . . . . . . . . . 369ThemeProperties.BarStacked property

(ThemeProperties object). . . . . . . . . . . . . . 369ThemeProperties.BarGraduatedStack property

(ThemeProperties object) . . . . . . . . . . . . . 370ThemeProperties.BarIndependentScale

property (ThemeProperties object) . . . . . 370ThemeProperties.BarWidth property

(ThemeProperties object). . . . . . . . . . . . . . 370ThemeProperties.BarFramed property

(ThemeProperties object). . . . . . . . . . . . . . 371ThemeProperties.BarFrameStyle

(ThemeProperties object). . . . . . . . . . . . . . 371ThemeProperties.BorderStyle property

(ThemeProperties object) . . . . . . . . . . . . . 371ThemeProperties. ShowNegativeValues

property (ThemeProperties object) . . . . . 371ThemeProperties.PositiveSymbolStyle

property (ThemeProperties object) . . . . . 372ThemeProperties.NegativeSymbolStyle

property (ThemeProperties object) . . . . . 372ThemeProperties.GraduateSizeBy property

(ThemeProperties object). . . . . . . . . . . . . . 373ThemeProperties.DotColor property

(ThemeProperties object) . . . . . . . . . . . . . 373ThemeProperties.RoundRanges property

(ThemeProperties object). . . . . . . . . . . . . . 373ThemeProperties.RoundBy property

(ThemeProperties object). . . . . . . . . . . . . . 373ThemeProperties.InflectRanges property

(ThemeProperties object). . . . . . . . . . . . . . 374ThemeProperties.InflectionRange property

(ThemeProperties object). . . . . . . . . . . . . . 374ThemeProperties.InflectionColor property

(ThemeProperties object). . . . . . . . . . . . . . 375ThemeProperties.ColorMethod property

(ThemeProperties object). . . . . . . . . . . . . . 375ThemeProperties.ApplyAttribute property

(ThemeProperties object). . . . . . . . . . . . . . 376

Title object . . . . . . . . . . . . . . . . . . . 377

Mapx Referenc x i

Page 14: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Table of Contents

Title.Border property (Title object) . . . . . . . 378Title.Caption property (Title object) . . . . . . 378Title.Editable property (Title object) . . . . . . 378Title.Position property (Title object) . . . . . . 378Title.TextStyle property (Title object) . . . . . 379Title.Visible property (Title object) . . . . . . . 379Title.X property (Title object) . . . . . . . . . . . . 379Title.Y property (Title object) . . . . . . . . . . . . 379

MapX Events . . . . . . . . . . . . . . . . . 381AddFeatureToolUsed Event . . . . . . . . . . . . . 382AnnotationAdded event. . . . . . . . . . . . . . . . . 384AnnotationChanged event . . . . . . . . . . . . . . 385DataMismatch event . . . . . . . . . . . . . . . . . . . 387DrawUserLayer Event . . . . . . . . . . . . . . . . . . 391MapDraw event . . . . . . . . . . . . . . . . . . . . . . . . 394MapInitialized event . . . . . . . . . . . . . . . . . . . 394MapViewChanged event . . . . . . . . . . . . . . . . 394MouseWheel Event . . . . . . . . . . . . . . . . . . . . 395PolyToolUsed Event . . . . . . . . . . . . . . . . . . . . 396RequestData event . . . . . . . . . . . . . . . . . . . . . 401ResolveDataBind event . . . . . . . . . . . . . . . . . 404ResolveDataBindEx event . . . . . . . . . . . . . . . 404SelectionChanged event . . . . . . . . . . . . . . . . 405ThemeModifyRequested event . . . . . . . . . . 406ToolUsed event . . . . . . . . . . . . . . . . . . . . . . 407

Appendix A: MapX Error Codes . 411

Appendix B: Constants . . . . . . . . 423AggregationFunctionConstants . . . . . . . . . . 424AnnotationChangedTypeConstants . . . . . . . 424AnnotationTypeConstants . . . . . . . . . . . . . . . 424ApplyAttributeConstants. . . . . . . . . . . . . . . . 424AreaUnitConstants . . . . . . . . . . . . . . . . . . . . . 424BindLayerTypeConstants. . . . . . . . . . . . . . . . 425CircleTypeConstants . . . . . . . . . . . . . . . . . . 426ColorConstants . . . . . . . . . . . . . . . . . . . . . . . . 426ColorSpreadingMethodConstants . . . . . . . . 428ConversionConstants . . . . . . . . . . . . . . . . . . . 428CoordSysTypeConstants . . . . . . . . . . . . . . . . 429CursorConstants . . . . . . . . . . . . . . . . . . . . . . . 430DatasetTypeConstants . . . . . . . . . . . . . . . . . . 431

DistribMethodConstants. . . . . . . . . . . . . . . . . 432DotSizeConstants . . . . . . . . . . . . . . . . . . . . . . . 432ExportFormatConstants . . . . . . . . . . . . . . . . . 432FeatureTypeConstants . . . . . . . . . . . . . . . . . . 432FieldTypeConstants. . . . . . . . . . . . . . . . . . . . . 433FillPatternConstants . . . . . . . . . . . . . . . . . . . . 433Graduation Constants . . . . . . . . . . . . . . . . . . . 433IntersectionPointConstants . . . . . . . . . . . . . . 433IntersectionTestConstants . . . . . . . . . . . . . . . 434LineTypeConstants . . . . . . . . . . . . . . . . . . . . . 434LayerBeginAccessConstants . . . . . . . . . . . . . 434LayerEndAccessConstants . . . . . . . . . . . . . . . 434LayerInfoTypeConstants . . . . . . . . . . . . . . . . 434LayerSrvLayerOptions . . . . . . . . . . . . . . . . . . 434LayerTypeConstants . . . . . . . . . . . . . . . . . . . . 435MapDrawConstants . . . . . . . . . . . . . . . . . . . . 435MapUnitConstants. . . . . . . . . . . . . . . . . . . . . . 435MouseWheelSupportConstants . . . . . . . . . . . 436PaperUnitConstants . . . . . . . . . . . . . . . . . . . . 436PenStyleConstants . . . . . . . . . . . . . . . . . . . . . . 436PolyToolFlagConstants . . . . . . . . . . . . . . . . . . 437PositionConstants . . . . . . . . . . . . . . . . . . . . . . 437ResolveDataBindConstants . . . . . . . . . . . . . . 437SearchTypeConstants . . . . . . . . . . . . . . . . . . . 437SelectionTypeConstants . . . . . . . . . . . . . . . . . 438SpreadByConstants . . . . . . . . . . . . . . . . . . . . . 438StyleUnitConstants . . . . . . . . . . . . . . . . . . . . . 438SymbolTypeConstants . . . . . . . . . . . . . . . . . . 438ThemeTypeConstants . . . . . . . . . . . . . . . . . . . 438ToolConstants. . . . . . . . . . . . . . . . . . . . . . . . . . 439ToolFlagConstants . . . . . . . . . . . . . . . . . . . . . . 439ToolTypeConstants . . . . . . . . . . . . . . . . . . . . . 439

Appendix C: Creating Expressions . . .

441Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446

Appendix D: Geoset Keys . . . . . . .461

Appendix E: OLE_COLOR Values 469

xi i MapX Reference

Page 15: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

AffineTransform object

An AffineTransform object allows you to define rotated or skewed coordinate systems

Object Properties• AffineTransform.A, B, C, D, E, F properties (AffineTransform object)• AffineTransform.Units property (Affine Transform object)

Object Methods• AffineTransform.Set method (AffineTransform object)

Remarks

All properties are read-only. To modify the AffineTransform object, use the Set method.

To obtain an AffineTransform object, reference the CoordSys object's AffineTransform propertyor declare a new, stand-alone Affine Transform object.

See Also

For an introduction to affine transformations, see "Using Coordinate Systems" in the Developer's Guide or Help System.

AffineTransform.A, B, C, D, E, F properties (AffineTransform object)

Purpose

Read-only properties, representing the parameters of an affine transformation; return Double values.

Remarks

An affine transformation has the following form:

x' = Ax + By + C

y' = Dx + Ey + F

In these equations, the base coordinates (x,y) are transformed to produce the derived coordinates (x', y'). The six constants A through F determine the effect of the transformation, as follows:

A Performs scaling or stretching along X axis.

B Performs rotation or skewing along X axis.

C Performs shifting along X axis.

D Performs rotation or skewing along Y axis.

Page 16: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

AffineTransform.Set method (AffineTransform object)

These properties are all read-only; to set the properties, use the Set method.

AffineTransform.Set metho (AffineTransform object)

Purpose

Sets the properties of an affine transformation.

Syntax

OBJECT.Set UNITS [A, B, C, D, E, F ]

Remarks

All arguments are required.

An affine transformation has the following form:

x' = Ax + By + C

y' = Dx + Ey + F

In these equations, the base coordinates (x,y) are transformed to produce the derived coordinates (x', y').

AffineTransform.Units property (Affine Transform object)

Purpose

This is a read-only property that specifies the map units used by an affine transformation. It returns a short value matching one of the MapUnitConstants.

E Performs scaling or stretching along Y axis.

F Performs shifting along Y axis.

Part Description

OBJECT An AffineTransform object.

UNITS A MapUnitConstants value, such as miUnitMeter (7).

A Double value; performs scaling or stretching along X axis.

B Double value; performs rotation or skewing along X axis.

C Double value; performs shifting along X axis.

D Double value; performs scaling or stretching along Y axis.

E Double value; performs rotation or skewing along Y axis.

F Double value; performs shifting along Y axis.

2 MapX Reference

Page 17: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Annotation object and Annotations collection

Each Map has a collection of Annotations (Map.Annotations property). Annotations are either symbol or text objects, and are drawn on top of the map.

Annotations are typically used to add messages (text) to a map or to put symbols on a map. These annotations will scale with the map as you zoom in and out. They are not necessarily associated with a particular layer of the map and are always on top.

Note that the Annotation object has no properties for setting the position, symbol style, or text. Tcontrol these aspects of an annotation, you use the Annotation.Graphic property to obtain a Graphic object, then modify the Graphic object.

Object Properties• Annotation.Graphic property (Annotation object)• Annotation.Type property (Annotation object)

Collection Properties• Annotations.Count property (Annotations collection) • Annotations.Editable property (Annotations collection)• Annotations.Item property (Annotations collection)

Collection Methods• Annotations.ActiveAnnotation method (Annotations collection)• Annotations.AddSymbol method (Annotations collection)• Annotations.AddText method (Annotations collection)• Annotations.Remove method (Annotations collection)• Annotations.RemoveAll method (Annotations collection)

Example in C++

// Annotations object

// Annotation.Type method

// Annotation.Graphic method

void CSampleProjectView::ChangeAllAnnotations() {

// Change the color of all of the existing annotations

// (both symbol and text) to Maroon

try {

CMapXAnnotations Annotations = Map.GetAnnotations();

CMapXAnnotation CurrentAnnotation;

long i,AnnotCount = Annotations.GetCount();

for(i=1;i<=AnnotCount;i++) { // Loop through all of the annotations

Page 18: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Annotation object and Annotations collection

CurrentAnnotation = Annotations.Item(i);

if(CurrentAnnotation.GetType() == miSymbolAnnotation) {

// The annotation is a symbol

CurrentAnnotation.GetGraphic().GetStyle().SetSymbolFontColor(miColorMaroon);

} else {

// The annotation is a text annotation

CurrentAnnotation.GetGraphic().GetStyle().SetTextFontColor(miColorMaroon);

}

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub ChangeAnnotations_Click()

' Change the color of all of the existing annotations

'(both symbol and text) to Maroon

Dim CurrentAnnotation As Annotation

For Each CurrentAnnotation In Map1.Annotations

' Loop through all of the annotations

If CurrentAnnotation.Type = miSymbolAnnotation Then

CurrentAnnotation.Graphic.Style.SymbolFontColor _

= miColorMaroon

Else

CurrentAnnotation.Graphic.Style.TextFontColor _

= miColorMaroon

End If

Next

End Sub

See Also

Map object

4 MapX Reference

Page 19: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Annotation.Graphic property (Annotation object)

Annotation.Graphic property (Annotation object)

Purpose

This contains a Graphic object, which contains the properties for the Annotation. See Graphic object description.

See Also

Graphic object

Annotation.Type property (Annotation object)

Purpose

Specifies the annotation type. This is an AnnotationTypeConstants value, and can be either miSymbolAnnotation or miTextAnnotation. This is a read-only property

See Also

AnnotationTypeConstants

Annotations.ActiveAnnotation method (Annotations collection)

Purpose

This method returns the active (currently selected) annotation.

Syntax

OBJECT ActiveAnnotation

Annotations.AddSymbol method (Annotations collection)

Purpose

Adds a symbol to the annotation collection. The default style is used (as specified in Map.DefaultStyle).

Mapx Referenc 5

Page 20: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Annotations.AddText method (Annotations collection)

Syntax

Annotations.AddSymbol [X, Y]

See Also

Map.DefaultStyle property

Graphic.X property

Graphic.Y property

Example

Map1.Annotations.AddSymbol -75.14, 42.9

Map1.Annotations.AddSymbol -98, 31.56

Map1.Annotations.AddSymbol -118.92, 36.75

Map1.Refresh

Annotations.AddText metho (Annotations collection)

Purpose

Adds a text annotation to the annotation collection. A default style is used (as specified in Map.DefaultStyle).

Syntax

OBJECT.AddText ( Text, X, Y, [Position] )

Part Description

X X coordinate of the symbol to add. This is a Double value, and specifies the map coordinate (longitude).

Y Y coordinate of the symbol to add. This is a Double value, and specifies the map coordinate (latitude).

Part Description

OBJECT Represents a place holder for an Annotations object.

Text String value. Becomes the Caption of the new annotation.

X X coordinate to place the text. This is Double value, and specifies the map coordinate (longitude).

Y Y coordinate to place the text. This is double value, and specifies the map coordinate (latitude).

Position Reference point to add text with respect to the x,y coordinates. This takes a PositionConstants value.

6 MapX Reference

Page 21: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Annotations.Count property (Annotations collection)

See Also

Map.DefaultStyle property

Graphic.Caption property

Graphic.Position property

Graphic.X property

Graphic.Y property

PositionConstants

Example

Private Sub Command1_Click()

Map1.Annotations.AddText "An Annotation", -75.14, 42.9, _

miPositionTL

Map1.Annotations.AddText "Another One", -98, 31.56, _

miPositionCC

Map1.Annotations.AddText "A Third", -118.92, 36.75, _

miPosition BR

End Sub

Annotations.Count property (Annotations collection)

Purpose

Specifies the number of Annotation objects in the collection. This is an Integer value, and is read-only.

Annotations.Editable property (Annotations collection)

Purpose

Controls whether the annotations are editable by the end user. An editable annotation can be moved, resized and edited in place by the end user. This is a Boolean value, and defaults to True.

Mapx Referenc 7

Page 22: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Annotations.Item property (Annotations collection)

Annotations.Item property (Annotations collection)

Purpose

This gets an Annotation object from the collection. An index is used to specify which Annotation to get. The index is an Integer value from 1 to Annotations.Count. This is the default property for the Annotations collection.

See Also

Annotations.Count property

Annotations.Remove method (Annotations collection)

Purpose

Removes an annotation object from the collection.

Note: If you remove an item, the collection indexes are renumbered to fill in the hole left by the item removed.

Syntax

OBJECT.Remove (Index)

Example

`Remove the second annotation

Map1.Annotations.Remove 2

See Also

Annotations.Count property

Part Description

OBJECT Represents a place holder for an Annotations object.

Index Index of the annotation to use. This is an Integer, between the values of 1 and AnnotationCount.

8 MapX Reference

Page 23: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Annotations.RemoveAll method (Annotations collection)

Annotations.RemoveAll method (Annotations collection)

Purpose

Removes all annotation objects from the collection.

Syntax

OBJECT.RemoveAll

Part Description

OBJECT Represents a place holder for an Annotations object.

Mapx Referenc 9

Page 24: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Annotations.RemoveAll method (Annotations collection)

10 MapX Reference

Page 25: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BindLayer object

The BindLayer object is used as a parameter to the Datasets.Add method. It is used to specify information on how to perform the data binding. This is required when binding data that has X and Y coordinates or data like zip codes, and you want points created at these locations in a new layer.

Object Properties• BindLayer.CoordSys property (BindLayer object)• BindLayer.Filespec property (BindLayer object)• BindLayer.KeyLength property (BindLayer object)• BindLayer.LayerName property (BindLayer object)• BindLayer.LayerType property (BindLayer object)• BindLayer.RefColumn1 property (BindLayer object)• BindLayer.RefColumn2 property (BindLayer object)• BindLayer.ReferenceLayer property (BindLayer object)• BindLayer.ReferenceLayerField property (BindLayer object)

Example in Visual Basic

` Set up the bind layer object

Dim BindLayerObject As New MapXLib.BindLayer

BindLayerObject.LayerName = "Customer's By Lat/Long coords"

BindLayerObject.RefColumn1 = 3 ` The third _

column in my source data contains x coords

BindLayerObject.RefColumn2 = 4 ` The fourth _

column in my source data contains y coords

BindLayerObject.LayerType = miBindLayerTypeXY

` The values in the source data column named "GEOABBR" will _

be used as the geofield for the new point table

Set MyDataset = Map.Datasets.Add(1, Data2.Recordset, _

"Lat/Long Dataset", "GEOABBR", , BindLayerObject)

MyDataset.Themes.Add

Example in C++

void CSampleProjectView::BindLayerUse(CDaoRecordset& SourceDAORecordset) {

CMapXBindLayer BindLayerObject;

CMapXDataset MyDataset;

COleVariant SourceDataVt,BindLayerVt;

Page 26: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BindLayer object

// Create a new bindlayer object

if(!BindLayerObject.CreateDispatch(BindLayerObject.GetClsid())) {

TRACE0("Failed to Create a BindLayer object");

return;

}

try {

// Set up the bind layer object

BindLayerObject.SetLayerName("Customers By Lat/Long Coords");

// The third column in my source data contains the // X coordinates

BindLayerObject.SetRefColumn1(3);

// The fourth column in my source data contains the // Y coordinates

BindLayerObject.SetRefColumn2(4);

BindLayerObject.SetLayerType(miBindLayerTypeXY);

BindLayerVt.vt = VT_DISPATCH;

BindLayerVt.pdispVal = BindLayerObject.m_lpDispatch;

SourceDataVt.vt= VT_DISPATCH;

SourceDataVt.pdispVal = SourceDAORecordset.m_pDAORecordset;

// The values in the source data column named "GEOABBR" _

will be used as the geofield for the new point table

MyDataset = m_Map.GetDatasets().Add(miDataSetDAO,SourceDataVt,COleVariant("Lat/Long Dataset"),COleVariant("GEOABBR"), COptionalVariant(), BindLayerVt, COptionalVariant(), COptionalVariant());

MyDataset.GetThemes().Add();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

12 MapX Reference

Page 27: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BindLayer.CoordSys property (BindLayer object)

See Also

Datasets.Add method

BindLayer.CoordSys property (BindLayer object)

Purpose

A CoordSys object that controls the coordinate system used when you create a layer.

Remarks

When you perform x/y or pointref data binding to create a layer of points, the BindLayer.CoordSys property specifies the coordinate system in which the layer will be created. Furthermore, in the case of x/y data binding, MapX uses this coordinate system to interpret the data source's x- and y-coordinates. For example, if you know that a data source contains x- and y-coordinates in state plane coordinates, set the BindLayer.CoordSys to use a state plane coordinate system.

If you do not set this property, the current Map.NumericCoordSys property is used as the coordinate system.

BindLayer.Filespec property (BindLayer object)

Purpose

Allows you to specify the name and location of a file, so that the Datasets.Add method can create a permanent layer instead of a temporary layer. It is a string property which should be set to the file path of the layer to create.

Remarks

This property applies to x/y data binding and pointref data binding (i.e. the BindLayer.LayerType property is miBindLayerTypeXY or miBindLayerTypePointRef).

If you assign a file path and name to this property, the Datasets.Add method creates a permanent layer, stored at the path that you specified. If you do not assign this property, the layer is temporary.

BindLayer.KeyLength property (BindLayer object)

Purpose

This is an integer property which specifies the length of the character column in the layer that is produced by Datasets.Add.

Mapx Referenc 13

Page 28: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BindLayer.LayerName property (BindLayer object)

Remarks

If you do not assign a value to this property, the default key length is 254. In other words, the resulting layer will include a column 254 characters wide.

BindLayer.LayerName property (BindLayer object)

Purpose

Specifies the name of the layer to bind data to if BindLayer.LayerType is miBindLayerTypeNormal, or the name of the newly created layer if BindLayer.LayerType is miBindLayerTypeXY or miBindLayerTypePointRef. This is a String value.

See Also

BindLayerTypeConstants

BindLayer.ReferenceLayer property

BindLayer.LayerType property

BindLayer.RefColumn1 property

BindLayer.RefColumn2 property

BindLayer.LayerType property (BindLayer object)

Purpose

Specifies what layer type data is being bound to. Binding data refers to the process of creating a DataSet, which is done using the DataSets.Add method. This property takes a BindLayerTypeConstant value, as described below

Discussion

If set to miBindLayerTypeNormal , that means you are binding (adding) data to a layer in the GeoDictionary

If set to miBindLayerTypeXY, this indicates that the data has X and Y coordinates in it, and you want a new layer of points to be created. When this is used, you need to specify the name of the newly created point layer (BindLayer.LayerName), the field in the data that contains the X coordinate (BindLayer.RefColumn1), and the field that contains the Y coordinate (BindLayer.RefColumn2).

If set to miBindLayerTypePointRef, this indicates that your data contains values that you want to match to information in a point reference file. A new layer is created containing a point for each row in the source data that matches an entry in the point reference file. For example, if your source data contains ZipCode information, and you have a point reference file containing U.S ZipCode Centers installed in your GeoDictionary, you can create a new layer containing a point for each

14 MapX Reference

Page 29: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BindLayer.RefColumn1 property (BindLayer object)

ZipCode contained in your source data (or multiple points if a ZipCode appears more than once). When this is used, you need to specify the name of the newly created point layer (BindLayer.LayerName), the field in the data that contains the reference data. (BindLayer.RefColumn1), and the name of the point reference file - the file that has the ZipCode locations in the above example. (BindLayer.ReferenceLayer) . The point reference file must be installed in the GeoDictionary.

See Also

DataSets.Add method

BindLayerTypeConstants

BindLayer.ReferenceLayer property

BindLayer.LayerName property

BindLayer.RefColumn1 property

BindLayer.RefColumn2 property

BindLayer.RefColumn1 property (BindLayer object)

Purpose

Specifies the field name or field number (starting at one) of either:• the field containing the X value (longitude) when BindLayer.LayerType is

miBindLayerTypeXY.• the field containing the reference value (such as ZipCode) when

BindLayer.LayerType is miBindLayerTypePointRef.

See Also

BindLayer Object

BindLayerTypeConstants

BindLayer.RefColumn2 property (BindLayer object)

Purpose

Specifies the field name or field number (starting at one) of the field containing the Y value (latitude) when BindLayer.LayerType is miBindLayerTypeXY.

See Also

BindLayer.LayerType

BindLayerTypeConstants

Mapx Referenc 15

Page 30: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BindLayer.ReferenceLayer property (BindLayer object)

BindLayer.ReferenceLayer property (BindLayer object)

Purpose

Specifies the name of the reference file to use if BindLayer.LayerType is miBindLayerTypePointRef. A reference layer is used when doing reference binding. This specifies the name of the reference file to use. A reference file contains the x and y coordinates for items such as Zip codes. MapX ships with the "US 5 Digit Zipcode Centers" layer which may be used for pointref binding at the zipcode level.

The ReferenceLayer property can be set to a layer's filename (a full file specification) or set to the layer's "friendly name" (the description that is assigned to the layer through the geodictionary).

PointReference binding (data binding of type miBindLayerTypePointRef), can be done using any table as a reference layer, not just CPF files. Specify the reference layer as the ReferenceLayer property of the BindLayer object provided to the Datasets.Add method when doing a PointReference bind.

Example in Visual Basic

` To do a ZipCode bind:

Dim MyDataset as Dataset

` Set up the bind layer object

Dim BindLayerObject As New MapXLib.BindLayer

BindLayerObject.LayerName = "Customer's By Zipcode centers"

BindLayerObject.RefColumn1 = 3 ` The third _

column in my source data contains zip code info

BindLayerObject.LayerType = miBindLayerTypePointRef

BindLayerObject.ReferenceLayer = "US 5 Digit Zipcode Centers"

` The values in the source data column named "GEOABBR" will _

be used as the geofield for the new point table

Set MyDataset = Map.Datasets.Add(miDataSetDAO, _

Data2.Recordset, "Zipcode Dataset", "GEOABBR", , _

BindLayerObject)

MyDataset.Themes.Add

Example in C++

void CSampleProjectView::ZipcodeBind(CDaoRecordset& SourceDAORecordset) {

CMapXDataset MyDataset;

CMapXBindLayer BindLayerObject;

COleVariant SourceDataVt,BindLayerVt;

// Create the BindLayer object

16 MapX Reference

Page 31: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BindLayer.ReferenceLayer property (BindLayer object)

if(!BindLayerObject.CreateDispatch(BindLayerObject.GetClsid())) {

TRACE0("Failed to Create BindLayer Object");

return;

}

// Set up all of the Variant paramaters

SourceDataVt.vt= VT_DISPATCH;

SourceDataVt.pdispVal = SourceDAORecordset.m_pDAORecordset;

BindLayerVt.vt = VT_DISPATCH;

BindLayerVt.pdispVal = BindLayerObject.m_lpDispatch;

try {

// Set up the bind layer object

BindLayerObject.SetLayerName("Customers By Zipcode Centers");

// The third column in my source data contains zip code info

BindLayerObject.SetRefColumn1(3);

BindLayerObject.SetLayerType(miBindLayerTypePointRef);

BindLayerObject.SetReferenceLayer("US 5 Digit Zipcode Centers");

// The values in the source data column named "GEOABBR" //will be used as the geofield for the new point table

MyDataset = m_Map.GetDatasets().Add(miDataSetDAO,SourceDataVt,COleVariant("Zipcode Dataset"),COleVariant("GEOABBR"), COptionalVariant(), BindLayerVt, COptionalVariant(),COptionalVariant());

MyDataset.GetThemes().Add();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Mapx Referenc 17

Page 32: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BindLayer.ReferenceLayerField property (BindLayer object)

See Also

BindLayer.LayerType

BindLayerTypeConstants

BindLayer.ReferenceLayerField property (BindLayer object)

Purpose

It specifies what field (by number, starting at 1) in the mapinfo table to bind to. If not specified, MapX will sample the source data for the column and choose the column with the highest match rate. If none match, then the first column is chosen.

Remarks

This property is optional (does not need to be set). It is only valid for BindLayerTypeNormal and is only valid when the layer to bind to is specified in the LayerName property.

18 MapX Reference

Page 33: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BitmapSymbol object and BitmapSymbols collection

A BitmapSymbol object represents one of the bitmap symbols available on the user's system.

A BitmapSymbols collection represents the set of all bitmap symbols on the user's system.

Note: BitmapSymbols.Item is the default property for the BitmapSymbols collection.

Object Properties• BitmapSymbol.Name property

Collection Properties• BitmapSymbols.Count property• BitmapSymbols.Item property

Collection Methods• BitmapSymbols.Refresh method• BitmapSymbols.Unload method

Examples in C++

Example 1:

// Bitmap Symbols

void CSampleProjectView::CreateBitmapList(CListBox* List) {

// Fill the ListBox with all of the names of the bitmap// symbols. Then, the application could respond to a double // click in the listbox by changing the style of some object// on the map

CMapXBitmapSymbols Bitmaps;

if(!Bitmaps.CreateDispatch(Bitmaps.GetClsid())) {

TRACE0("Failed to create BitmapSymbols Object");

return;

}

try {

long bmpCount = Bitmaps.GetCount();

for(long i= 1;i<=bmpCount;i++) {

List->AddString(Bitmaps.Item(i).GetName());

}

} catch (COleDispatchException *e) {

e->ReportError();

Page 34: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BitmapSymbol object and BitmapSymbols collection

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example 2:

void CSampleProjectView::GlobeSymbols() {

// Override the style of the US Top 20 Cities layer of the // US geoset// so that each city has the icon of a Globe

CMapXLayer Top20Cities;

try {

Top20Cities = m_Map.GetLayers().Item("US Top 20 Cities");

Top20Cities.SetOverrideStyle(TRUE);

// Bitmap Symbols only work on Feature, Layer, and Theme// objects. The SupportsBitmapSymbols property will be true// if Bitmap symbols work on the style object

if(Top20Cities.GetStyle().GetSupportsBitmapSymbols()) {

Top20Cities.GetStyle().SetSymbolType(miSymbolTypeBitmap);

Top20Cities.GetStyle().SetSymbolBitmapSize(12);

Top20Cities.GetStyle().SetSymbolBitmapTransparent(TRUE);

Top20Cities.GetStyle().SetSymbolBitmapName("Glob1-32.bmp");

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Examples in Visual Basic

Example 1:

Private Sub Form_Load()

' Fill the ListBox with all of the names of the bitmap symbols

' Then, the application could respond to a double click _

20 MapX Reference

Page 35: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BitmapSymbol object and BitmapSymbols collection

in the listbox by

' changing the style of some object on the map

Dim Bitmaps As New MapXLib.BitmapSymbols

For Each symb In Bitmaps

List1.AddItem symb.Name

Next

End Sub

Example 2:

Private Sub GlobeSymbols_Click()

'Override the style of the US Top 20 Cities layer of the _

US geoset

' so that each city has the icon of a Globe

Dim Top20Cities As MapXLib.Layer

Set Top20Cities = Map1.Layers("US Top 20 Cities")

Top20Cities.OverrideStyle = True

' Bitmap Symbols only work on Feature, Layer, and _

Theme objects

' The SupportsBitmapSymbols property will be true if _

Bitmap symbols

' work on the style object

If Top20Cities.Style.SupportsBitmapSymbols = True Then

Top20Cities.Style.SymbolType = miSymbolTypeBitmap

Top20Cities.Style.SymbolBitmapSize = 12

Top20Cities.Style.SymbolBitmapTransparent = True

Top20Cities.Style.SymbolBitmapName = "Glob1-32.bmp"

End If

End Sub

Mapx Referenc 21

Page 36: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BitmapSymbol.Name property (BitmapSymbol object)

BitmapSymbol.Name property (BitmapSymbol object)

Purpose

Read-only string representing the file name (e.g. "filename.bmp") that identifies a bitmap symbol.

Remarks

The Name property is read-only. Use this property to determine the name of a bitmap symbol file (*.bmp); you can assign that name to a Style object's SymbolBitmapName property

See Also

Bitmap symbols

BitmapSymbols.Count property (BitmapSymbols collection)

Purpose

Returns the number of items in the collection (i.e. the number of bitmaps available to be used as bitmap symbols). Read-only.

See Also

Bitmap symbols

BitmapSymbols.Item property (BitmapSymbols collection)

Purpose

This read-only property returns a BitmapSymbol object from the collection; use numeric index only. This is the default property for the BitmapSymbols collection.

Syntax

[ BitmapSymbol= ]OBJECT.Item (index)

See Also

Bitmap symbols

Parts Description

OBJECT Represents a BitmapSymbols object.

index An integer indicating which BitmapSymbol object to return.

22 MapX Reference

Page 37: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BitmapSymbols.Refresh method (BitmapSymbols collection)

BitmapSymbols.Refresh method (BitmapSymbols collection)

Purpose

Updates the BitmapSymbols collection, if necessary, to guarantee that the collection is current.

Remarks

The BitmapSymbols collection represents the set of .bmp files found in the CUSTSYMB directory. However, if you add .bmp files while MapX is running, MapX does not update the collection automatically. To guarantee that the BitmapSymbols collection is current, use the Refresh method.

Syntax

OBJECT Refresh ()

See Also

Bitmap symbols

BitmapSymbols.Unload method (BitmapSymbols collection)

Purpose

Unloads all previously loaded .bmp files, and frees any associated resources.

Remarks

When the BitmapSymbols collection goes out of scope, resources are not freed automatically. When you are done using a BitmapSymbols collection, use the Unload method to explicitly free the associated resources.

If you do not use this method to explicitly free the collection's resources, the resources are freed when MapX libraries (e.g. mitmdl30.dll) are unloaded.

Syntax

OBJECT Unload ()

See Also

Bitmap symbols

Mapx Referenc 23

Page 38: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BitmapSymbols.Unload method (BitmapSymbols collection)

24 MapX Reference

Page 39: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

CoordSys object

A CoordSys object represents a coordinate system.

Object Properties• CoordSys.AffineTransform property • CoordSys.Azimuth property • CoordSys.Bounds property • CoordSys.Datum property • CoordSys.FalseEasting, FalseNorthing properties ()• CoordSys.OriginLatitude, OriginLongitude properties • CoordSys.Range property • CoordSys.ScaleFactor property • CoordSys.StandardParallelOne, StandardParallelTwo properties • CoordSys.Type property• CoordSys.Units property

Object Methods• CoordSys.Clone method • CoordSys.PickCoordSys method • CoordSys.Set method

Remarks

All properties are read-only. To modify a coordinate system, use the Set method or the PickCoordSys method, or assign it to equal another CoordSys object.

To obtain a CoordSys object, reference the Map.DisplayCoordSys propertyMap.NumericCoordSys property, or Layer.CoordSys property.

CoordSys.AffineTransform property (CoordSys object)

Purpose

Read-only property; returns an AffineTransform object.

CoordSys.Azimuth property (CoordSys object)

Purpose

Read-only property; returns a Double value representing the coordinate system's azimuth.

Page 40: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

CoordSys.Bounds property (CoordSys object)

CoordSys.Bounds property (CoordSys object)

Purpose

Read-only property; returns a rectangle object representing the bounds of the coordinate system.

CoordSys.Clone method (CoordSys object)

Purpose

Makes a copy of this coordinate system as a new CoordSys object.

Syntax

[ CoordSys= ]OBJECT Clone ()

CoordSys.Datum property (CoordSys object)

Purpose

Read-only property; returns a Datum object.

CoordSys.FalseEasting, FalseNorthing properties (CoordSys object)

Purpose

Read-only properties; return Double values, representing coordinate system's false easting/false northing settings.

Remarks

The units are determined by the CoordSys.Unit property

CoordSys.OriginLatitude, OriginLongitude properties (CoordSys object)

Purpose

Read-only properties that return the coordinate system's origin latitude/origin longitude settings, as Double values.

26 MapX Reference

Page 41: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

CoordSys.PickCoordSys method (CoordSys object)

CoordSys.PickCoordSys method (CoordSys object)

Purpose

Displays a dialog box that allows the user to select a coordinate system.

Syntax

[Boolean=]OBJECT.PickCoordSys (HelpFile, HelpID)

Remarks

The dialog box is automatically initialized, so that the highlighted description matches the CoordSys object.

If the user clicks OK on the dialog box, the method returns True, and the CoordSys object is updated to match the coordinate system that the user chose. If the user clicks Cancel, the method returns False, and the CoordSys object is left unchanged.

MapX initializes the list of available coordinate systems by reading the contents of the file mapinfow.prj, which is located in the same directory as mapx40.ocx.

CoordSys.Range property (CoordSys object)

Purpose

Read-only property; returns a Double value, representing the coordinate system's range (a number from 1 to 180, dictating how much of the earth will be visible).

CoordSys.ScaleFactor property (CoordSys object)

Purpose

Read-only property; returns a Double value representing the coordinate system's scale factor

Part Description

OBJECT A CoordSys object.

HelpFile Variant: A string identifying the name and location of a Windows Help file. Optional; if omitted, the dialog appears without Help button.

HelpID Variant: An integer ID number that identifies which Help topic to display. Optional; the dialog appears without a Help button.

Mapx Referenc 27

Page 42: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

CoordSys.Set method (CoordSys object)

CoordSys.Set method (CoordSys object)

Purpose

Sets the properties of a CoordSys object.

Syntax

OBJECT Set Type, [Datum], [Units], [OriginLongitude], [OriginLatitude],

[StandardParallelOne], [StandardParallelTwo], [Azimuth], [ScaleFactor],

[FalseEasting], [FalseNorthing], [Range], [Bounds], [AffineTransform]

Remarks

The Type argument is always required. All other arguments are variants; these arguments might be required, depending on which projection/coordinate system you select.

If an argument is not required, you may pass in any value or omit it entirely.

Part Description

object A CoordSys object.

Type A short CoordSysTypeConstants value, such as miRobinson (12).

Datum A Datum object or a supported datum number (such as 62 for the “NAD 27” datum for the Continental US).

Units A MapUnitConstants value, such a miUnitMeter (7).

OriginLongitudeOriginLatitude

Double values, indicating the standard parallels (in degrees of the latitude).

StandardParallelOneStandardParallelTwo

Double values, indicating the standard parallels (in degrees of latitude).

Azimuth Double value, representing the azimuth, in degrees.

ScaleFactor Double value, representing a scale factor.

FalseEastingFalseNorthing

Double values, representing Falseeasting and FalseNorthing (in Units specified by the Units argument).

Range Double value: Degrees of latitude from 1 to 180, indicating the range (how what range of the earth will be visible).

Bounds A Rectangle object representing the outer bounds of the coordinate system in Units specified by the Units argument. Required if Type is miNonEarth; otherwise optional.

AffineTransformation An AffineTransform object; this argument is always optional.

28 MapX Reference

Page 43: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

CoordSys.StandardParallelOne, StandardParallelTwo properties (CoordSys object)

CoordSys.StandardParallelOne, StandardParallelTwo properties (CoordSys object)

Purpose

Read-only property; returns the coordinate system's standard parallel settings, as Double values in degrees of latitude.

CoordSys.Type property (CoordSys object)

Purpose

Read-only property; returns a short value matching one of the CoordSysTypeConstants . Syntax

CoordSys.Units property (CoordSys object)

Purpose

Read-only property; returns a short value matching one of the MapUnitConstants.

Mapx Referenc 29

Page 44: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

CoordSys.Units property (CoordSys object)

30 MapX Reference

Page 45: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSet object and DataSets collection

Each Map has a collection of DataSets. The DataSets collection has methods and properties used to add and remove DataSet objects from the collection. For more information see the discussion on data binding, below.

Data Binding

Data Binding is the process of bringing data from a data source into MapX. The data source might be a Visual Basic data control, or an ODBC data source. In MapX, the data is represented as a DataSet object.

Data binding can be done two ways. If you have Visual Basic for bound data controls, at design time you can use the DataSet property of the Map object. Or, bind data programmatically by using the DataSets.Add method. This method requires you to tell MapX which data source to use, some information about it, and which map layer to bind it to.

The binding process results in the creation of a DataSet object. This DataSet, which is added to the DataSets collection, contains computed values for features in the map layer that the data is bound to. For example, if data is bound to US States map, each state would have a new data value that could then be used to control how the states are drawn. If the data source had multiple records for a state, the values could be summed, averaged, or counted. The DataSet has a Value method you can use to access the computed value for each row (or feature) of the map.

A DataSource (the second parameter for DataSets.Add) is actually an OLE interface. MapX uses the interface to access the data directly from the data source. The data isn't actually passed to DataSets.Add. There are five DataSource types:

miDataSetDAO - Data Access Object Recordset. The SourceData parameter to DataSets.Add must be a daoRecordset object. You can get one from a Visual Basic data control, an Access form, or by creating one in Visual Basic, Access, or C++.

miDataSetODBC - Open DataBase Connectivity data source. MapX can use ODBC to retrieve data from any ODBC data source. You need to specify the connection string, the data source name, and the SQL string to execute by using the ODBCQueryInfo.

miDataSetGlobalHandle - This is a way to pass in a block of tab delimited data. The SourceData parameter to DataSets.Add must be a variant with type of VT_I4 and the lVal equal to the global memory handle. The format of each row of data in the block of global memory is:

field TAB field TAB field CRLF

" "

where field is a string value in quotes, or a numeric value without quotes, and TAB is 0x09, and CRLF is 0x0D 0x0A.

miDataSetOLEData - This is for containers such as PowerBuilder, that pass data to MapX in the

Page 46: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSet object and DataSets collection

format described in miDataGlobalHandle when initializing the MapX control. Then a call to DataSets.Add with miDataSetOLEData as the type tells MapX to build a dataset using the previously passed in data.

miDataSetUnbound - If you cannot support one of those formats, MapX provides a `back door'. This type can be used to set up an event loop whereby MapX asks the container for data values, a cell at a time. MapX will send the RequestData event, with the row and column number of the data value wanted. You can then use any method of getting the data and feeding it through this event back to MapX.

A data source may have many columns of data. MapX has overhead for each column of data that is bound, so you should only bind data that is needed in the map (such as data you want to thematically map or label with). Use the last parameter of DataSets.Add (Fields) to set up a field collection of the fields (columns) you want to bind to the map. This is also where you specify how multiple matches should be handled - for example, if the data looked like the following:

Here there are three sales in California, and since only one data value will be attached to California, we need to tell MapX to either sum the sales, average the sales or count the sales.

DataSets.Add has the following automated behaviors:• determine which column in the data source contains geographic information• determine which map layer to bind to

Both of these behaviors are optional. There are parameters to specify which column in the data source contains the geographic information as well as which map layer should be bound to. If you know either of these, you should specify them for performance reasons. For MapX to be able to bind data to a map layer, several things need to be true:

• the map's geographic key column needs to be indexed. Most maps come with indexed key columns when they are installed, but it is up to the map maker to decide which columns are key columns. For example, the United States could have at least 3 key columns - state name ("New York"), state abbreviation ("NY"), and FIPS code (36). The United States map MapInfo ships has the first two as key columns, thus requiring data from the data source to also have either state name or abbreviation.

• the map and it's key columns must be specified in the GeoDictionary. The Geodictionary is a file (GEODICT.DCT by default) that track this information for MapX. A program MIGM.EXE comes with MapX to maintain the GeoDictionary.

Some key columns from the map layer may not contain unique values. An example of this is United States Counties - multiple states have counties named "Warren" or "Washington". Thus, more information is needed to resolve the potential ambiguity. For the United States Counties

State Sales

CA 120

NY 100

CA 50

CA 110

32 MapX Reference

Page 47: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSet object and DataSets collection

example, State is used to resolve ambiguity. The parameter SecondaryGeoColumn is used to specify the column in the data source that contains the information needed to resolve the ambiguity. The GeoDictionary contains information about which maps have non-unique keys and what their refining map is.

Once a column is defined as the geographic column from the data source, and a map layer to bind to is determined, binding begins. Each row of the data source is `matched' to a feature and the data is brought in. If a row contains a geographic column that doesn't match a feature (perhaps a typo ("MASS" instead of "MA") or simply a data value that's not on the map ("Puerto Rico")), an event is fired to notify the container. The DataMismatch event can be ignored, in which case MapX simply ignores the row

A reference file provided with MapX contains information specifying where all the reference points are. MapX comes with a reference file for US ZipCodes, called ZIPCODES.CPF.

This type of data binding is done with the BindLayer BindLayer parameter - a BindLayer object is passed in to specify the type of binding and fields from the data source to use. Since the data from the data source is aggregated and stored in MapX, when the data changes in the data source, MapX does not reflect the change. The DataSet.Refresh method can be used to have MapX reread the source data and re-aggregate and store it. This, however, can be time consuming. DataSet.Refresh does not work for DataSets that create new point layers - the proper way to add data to these layers would be two steps:

• Create a point layer, where each point has a key value• Bind data to that newly created point layer (using DataSets.Add again). The second

DataSet can be refreshed.

Object Properties• DataSet.Fields property (DataSet object)• DataSet.GeoField property (DataSet object)• DataSet.Layer property (DataSet object)• DataSet.Name property (DataSet object)• DataSet.RowCount property (DataSet object)• Dataset.ReadOnly property (Dataset object)• DataSet.SecondaryGeoField property (DataSet object)• DataSet.SourceRows property (DataSet object)• DataSet.Themes property (DataSet object)• DataSet.Type property (Dataset object)

Object Methods• DataSet.AddField method (DataSet object)• DataSet.Refresh method (DataSet object)• Dataset.RowValues method (Dataset object)• DataSets.Restore method (DataSets collection)• DataSet.Value method (DataSet object)

Mapx Referenc 33

Page 48: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSet.AddField method (DataSet object)

Collection Properties• Datasets.BuildSourceRows property (Datasets collection)• DataSets.Count property (DataSets collection)• DataSets.Item property (DataSets collection)

Collection Methods• DataSets.Add method (DataSets collection)• DataSets.Remove method (DataSets collection)• DataSets.RemoveAll method (DataSets collection)

DataSet.AddField metho (DataSet object)

Purpose

This allows a field ('column') to be added to a dataset that is an expression containing functions, operators, and datasets fields (from the current dataset only). This will add a new field to the dataset's field collection for labelling, thematics, etc.

Syntax

OBJECT AddField (Name, Expression)

Remarks

The new field will have a type that is either miTypeNumeric or miTypeString depending upon the return type of the expression.

The new field will have an aggregation type of miAggregationSum for numeric fields and miAggregationIndividual for string fields.

The field is added to the end of the fields collection for the dataset and is temporary. That is, when the application terminates, the field will disappear.

Exceptions are thrown for invalid expressions, an invalid name parameter, or a non-unique field name.

Parts Description

OBJECT Represents a DataSet object.

Name The name of the new field.

Expression The created expression.

34 MapX Reference

Page 49: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Datasets.BuildSourceRows property (Datasets collection)

Datasets.BuildSourceRows property (Datasets collection)

Purpose

Datasets created from a Datasets collection with this property set to TRUE, will support the Dataset.GetSourceRows method. Those datasets created from a Datasets collection with this property set to FALSE will not, and calling Datasets.GetSourceRows on those Dataset objects will result in an exception.

Remarks

A given dataset either supports or does not support the Datasets.GetSourceRows method throughout it's lifetime. Changing the property on the datasets collection will not effect dataset objects previously created from that dataset collection.

DataSet.Fields property (DataSet object)

Purpose

Fields collection for the dataset.

See Also

Field object and collection

DataSet.GeoField property (DataSet object)

Purpose

The column number of the geographic key column in the Fields collection. This is an Integer value and a read-only property

DataSet.Layer property (DataSet object)

Purpose

The Layer object this dataset is bound to.

Remarks

When a DataSet is added, the data is always attached to a layer. This points to the layer.

A layer may have more than one dataset bound to it. When a layer is deleted, any datasets bound to it are also deleted.

Mapx Referenc 35

Page 50: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSet.Name property (DataSet object)

Example in C++

// DataSet.Layer Property

// LabelProperties.Dataset Property

// LabelProperties.DataField Property

void CSampleProjectView::LabelLayer() {

// Label the Layer that "My Dataset" is bound to with

// the data from My Dataset's first column

try {

CMapXDataset myDataset = m_Map.GetDatasets().Item("My Dataset");

myDataset.GetLayer().GetLabelProperties().SetDataset(myDataset);

myDataset.GetLayer().GetLabelProperties().SetDataField(1);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub LabelLayer()

' Label the Layer that "My Dataset" is bound to with

' the data from My Dataset's first column

Dim myDataset as MapXLib.Dataset

Set myDataset = Map1.Datasets.Item("My Dataset")

myDataset.Layer.LabelProperties.Dataset = myDataset

myDataset.Layer.LabelProperties.DataField = 1

End Sub

DataSet.Name property (DataSet object)

Purpose

The name of a dataset. This is a String value.

Remarks

The name is a way to refer to this dataset when using methods such as DataSets.Item or DataSets.Remove. The name must be unique across all datasets in the dataset collection.

36 MapX Reference

Page 51: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSet.Refresh method (DataSet object)

DataSet.Refresh method (DataSet object)

Purpose

Forces a re-read of the data from the data source.

Syntax

DataSet.Refresh

Remarks

This method is used to update the map if there are changes in the data.

When the Refresh method is invoked, the data is re-read from the original data source and re-aggregated using the aggregation methods defined by the fields in the dataset.

Any themes based on the dataset will be updated to reflect the new data.

Note: This will method will not work for datasets of typw miBindLayerTypeXY

Example

`Create the default theme on the dataset

ds.Themes.Add

Map1.Refresh

Dataset.RowValues method (Dataset object)

Purpose

Determines what a row can be: long row ID, string serialized key, or feature object to get key from.

Syntax

[RowValues=]OBJECT RowValues(Row)

Parts Description

OBJECT Represents a Dataset object.

Row Variant: Can be the FeatureID (integer), the FeatureKey (String), or a Feature object.

Mapx Referenc 37

Page 52: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSet.RowCount property (DataSet object)

DataSet.RowCount property (DataSet object)

Purpose

Returns the number of rows in a dataset. This is an Integer value. This is a read-only property

Remarks

Since this data is bound to a layer, RowCount actually returns the number of features in the layer. Therefore, items in a dataset can have a NULL values if no data was bound to the feature.

Dataset.ReadOnly property (Dataset object)

Purpose

A Readonly property that indicates if the dataset is updateable or not. Currently, only miDatasetLayer datasets are updateable. datasets are updated using the Layers.UpdateFeature or Feature.Update with a RowValues collection.

See Also

RowValue object and RowValues collection

Layer.UpdateFeature method

Feature.Update method

DataSets.Restore method (DataSets collection)

Purpose

This method can be used to restore a dataset from a map which has been stored to a file using OLE serialization. Since datasets rely on external data, the contents of the datasets are not serialized to the file along with the rest of the map's information. DataSets.Restore can be used to restore a dataset (and its themes) by pointing a deserialize map back to the external data.

38 MapX Reference

Page 53: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSet.SecondaryGeoField property (DataSet object)

Syntax

[ DataSet = ]OBJECT.Restore ( Name, SourceData )

See Also

DataSets.Add method

DataSet.SecondaryGeoField property (DataSet object)

Purpose

The column number of the secondary geographic key column in the Fields collection. The value will be 0 if no SecondaryGeoField was specified when the data was added. This is an Integer value and a Read-only property

DataSet.SourceRows property (DataSet object)

Purpose

The SourceRows collection of a Dataset contains the list of rows from the source data that were matched to a specified row

See Also

SourceRow object and SourceRows collection

Feature.FeatureKey property

DataSet.Themes property (DataSet object)

Purpose

Themes collection for the dataset.

See Also

Theme object and collection

Part Description

OBJECT A DataSets collection.

Name A string parameter. This is the name of the dataset to restore; it should be the name of a dataset which existed when the map was serialized.

SourceData A variant. This should be the same parameter as when the stored DataSet was added in the original DataSets.Add. This data source is then used to restore the contents of the dataset.

Mapx Referenc 39

Page 54: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSet.Type property (Dataset object)

DataSet.Type property (Dataset object)

Purpose

Read-only property that returns the type of Dataset. The value of this property will be one of the DatasetTypeConstants values.

Example in Visual Basic

Dim ds As MapXLib.Dataset

Set ds = Map1.Datasets(1)

If ds.Type = miDataSetODBC Then

' ... then this is an ODBC dataset

ElseIf ds.Type = miDataSetDAO Then

' ... then this is a DAO dataset

End If

DataSet.Value method (DataSet object)

Purpose

Retrieves values for a specified row and column in the dataset. This is a default property for the DataSet object.

Syntax

[value =] OBJECT.Value (Row, Column)

Remarks

The values returned are from the MapX DataSet, not the original source data. Since the original source data is aggregated and bound to a layer to form the MapX dataset, the Row numbers correspond to the features in the Layer, and not the original source row numbers. Therefore, cells in the dataset can have NULL values if no data was bound to the feature. A Null value is returned in the variant by setting the type of the variant to VT_NULL.

You can use a Feature object as the Row parameter, since a feature object uniquely identifies a single row in the Layer that the DataSet is bound to.

Part Description

OBJECT Represents a DataSet object.

Row Row in MapX to get value. Variant: can be one of:*Key of the feature*Name of the Feature*Feature object

Column Variant: can be column name or index.

40 MapX Reference

Page 55: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSet.Value method (DataSet object)

Example in C++

// Dataset.Value Method

void CSampleProjectView::QueryFeature(CTreeCtrl& queryResults,CMapXFeature& ftr,CMapXDataset& srcData) {

// This function builds a tree control with all of the values in the dataset

// Example output:

// Cheyenne

// Capital: Cheyenne

// State: WY

// FIPS_Code: 56

// Pop_1990: 50008

// Num_HU_90: 21859

CString fieldValue;

CString fieldName;

long fieldCount;

COleVariant ftrVt, valueVt;

HTREEITEM parentItem;

// First, use the feature's name as the parent node

// (all of the value nodes will be children of this node)

parentItem = queryResults.InsertItem(ftr.Name);

ftrVt.vt = VT_DISPATCH;

ftrVt.pdispVal = ftr;

try {

fieldCount = srcData.GetFields().GetCount();

// loop over all of the fields in the dataset

for(long i = 1;i<=fieldCount;i++) {

// Fetch the value from the dataset and add it to the Tree control

valueVt = srcData.GetValue(ftrVt,i);

if(valueVt.vt != VT_NULL) { // There is a value for the field

valueVt.ChangeType(VT_BSTR);

fieldValue = valueVt.bstrVal;

SysFreeString(valueVt.bstrVal);

// Add the string "Field: Value" to the tree

Mapx Referenc 41

Page 56: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSet.Value method (DataSet object)

fieldLine.Format("%s: %s",(LPCSTR)srcData.GetFields().Item(i).GetName(),(LPCSTR)fieldValue);

queryResults.InsertItem(fieldLine,parentItem);

}

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub QueryFeature(ftr As MapXLib.Feature,srcData As _

MapXLib.Dataset)

' This function builds a tree control with all of the _

values in the dataset

' Example output:

' Cheyenne

' Capital: Cheyenne

' State: WY

' FIPS_Code: 56

' Pop_1990: 50008

' Num_HU_90: 21859

Dim value As Variant

Dim parentItem As Node

' First, use the feature's name as the parent node

' (all of the value nodes will be children of this node)

Set parentItem = TreeView1.Nodes.Add(, , ftr.Name, ftr.Name)

' loop over all of the fields in the dataset

For Each Field In srcData.Fields

' Fetch the value from the dataset and add it to the _

Tree control

value = srcData.value(ftr, Field.Name)

' Add the string "Field: Value" to the tree

TreeView1.Nodes.Add parentItem, tvwChild, parentItem.Key _

42 MapX Reference

Page 57: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSets.Add method (DataSets collection)

& Field.Name & value, Field.Name & ": " & value

Next

End Sub

See Also

Feature.FeatureKey property

Feature.Name property

DataSets.Add method (DataSets collection)

Purpose

Creates a specified dataset and adds it to the collection.

Syntax

DataSets.Add ( Type, SourceData, [Name], [Geofield], [SecondaryGeofield], [BindLayer], [Fields], [Dynamic] )

Part Description

Type Type of dataset being added takes a DataSetTypeConstants value.

SourceData This is a reference to the data, and is different depending on the TYPEIDAORecordset, ODBCQueryInfo, Layer object, or nothing.

Name String that uniquely identifies the dataset. This is an optional parameter, and if not specified, a name in the form of DataSetN is used.

Geofield Name or index of the column that contains the geographic information. This is an optional parameter, and if not specified, MapX searches all fields to find one that matches entries in the GeoDictionary.

SecondaryGeofield Name or index of the column that contains the refining geographic information. This is an optional parameter.

BindLayer Specifies the Map layer to attach this data to, or, a BindLayerObject if incoming data is to be georeferenced to a point reference file (such as ZipCodes) or contains Long/Lat values. This is an optional parameter, and if not specified, MapX searches layers in the GeoDictionary to attach to.

Fields This is a Fields object which is in collection of Field objects. The field objects are used to describe which fields from the data source to bring in, and which aggregation function to use if more than one record for the data source matches a particular map feature. This is an optional parameter, and if not specified, all columns are brought in, and the data values are summed if more than one record is encountered per feature.

Mapx Referenc 43

Page 58: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSets.Add method (DataSets collection)

Note: If ambiguity exists (like multiple geosets), the user can specify an event handler to pick one. If no event handler is specified, MapX will pick the first one.

Note: Dataset type: miDatasetLayer - used to create a Dataset that references fields from a MapInfo table. The SourceData parameter is a Layer object.

Note: When doing BindLayer matching, the geofields must be unique. Only the first item of a non-unique set of data will be matched. The rest are ignored.

Remarks

If the automatic detection logic is being used, more than one match may be found. If you want to handle this case, you can implement the ResolveDataBind event handler. Otherwise, MapX picks the first one.

A SecondaryGeofield is required when the layer that a dataset is being bound to has a key column that is not unique by itself. The secondary geofield is then used to uniquely match an object (row) in the layer.

The GeoField column must be unique if a new layer of points is to be created (BindLayer.LayerType is miBindLayerTypeXY or miBindLayerTypePointRef). The GeoField column will be used to name the features in the new point layer. Non-unique values will result in a single point being added to the new point layer for the first occurrence of the duplicate key value, and data values in the duplicate rows will be aggregated.

If a Fields collection is specified, the Geofield and SecondaryGeofield parameters refer to columns in the Fields collection rather than in the source data.

If dynamic data binding is being used, the Field.AggregationFunction property is ignored for all field, and all fields are aggregated individually. In the case of multiple matching records, the first will be taken.

Example in Visual Basic

`This sample demonstrates the simplest use of the Datasets.Add

`method. With this usage, you specify only the data source and

`type. MapX automatically determines which column represents

`the geographic information, as well as which layer to bind that

`information to.

`Also demonstrated here is the simplest use of the Themes.Add

`method. In this usage, where all arguments are omitted, MapX

Dynamic Variant: A boolean value that controls whether the data binding is dynamic. Optional; if omitted, defaults to false, meaning that the binding is static (i.e., MapX will copy needed data when the database is opened). If you specify True, MapX accesses data in a live manner, only data needed (e.g. when labeling). If you specify True but the dataset does not support dynamic columns, an exception will be thrown.

Part Description

44 MapX Reference

Page 59: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSets.Add method (DataSets collection)

`automatically determines a name for the theme, which column to

`use to create the theme, and what type of theme to create. In

`this case, MapX will create a ranged theme on the first numeric

`column in the USA table (TOTPOPHIS).

Private Sub Command1_Click()

Dim db As Database

Dim rs As Recordset

Dim ds As Dataset

`First, get the table that will contain our source data

`Set db = DBEngine.Workspaces(0).OpenDatabase

`"C:\Program Files\MapInfo MapX\Data\Mapstats.mdb")

`Set rs = db.OpenRecordset("USA")

`This line will create a dataset named "Dataset1"

`Set ds = Map1.Datasets.Add(miDataSetDAO, rs)

`Create the default theme on the dataset

`ds.Themes.Add

End Sub

`This sample demonstrates the use of Datasets.Add and the

`RequestData event supported by MapX to build an unbound

`dataset, whichallows MapX to access data whose format is known

`only to the programmer. In thisexample, the data is in the form

`of a two-dimensional array in VB.

Private Const kNumberOfRows = 3

Dim theData(1 To 3, 1 To 2) As Variant

Private Sub Form_Load()

theData(1, 1) = "ME" `Fill in the data to

theData(2, 1) = "NH" `be used by RequestData

theData(3, 1) = "VT"

theData(1, 2) = 100

theData(2, 2) = 200

theData(3, 2) = 300

Map1.ZoomTo 800, -70.26, 44.05 `Zoom in on New England

End Sub

Mapx Referenc 45

Page 60: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSets.Add method (DataSets collection)

Private Sub Command1_Click()

Dim flds As New MapXLib.Fields

Dim ds As Dataset

`Describe the structure of the unbound dataset:

flds.Add "State", "State", miAggregationIndividual, _

miTypeString

flds.Add "Sales", "Sales", miAggregationSum, miTypeNumeric

`Create the unbound dataset. The "RequestData" event will be

`triggered to get the data to be used.

Set ds = Map1.Datasets.Add(miDataSetUnbound, Nothing, _

"My Dataset", "State", , "USA", flds)

`Create a theme based on the "Sales" column in the

`unbound dataset

ds.Themes.Add miThemeGradSymbol, "Sales", "My Theme"

End Sub

Private Sub Map1_RequestData(ByVal DataSetName As String, _

ByVal Row As Long, ByVal Field As Integer, _

Value As Variant, Done As Boolean)

Done = False

If DataSetName <> "My Dataset" Or Row > kNumberOfRows Then

Done = True

Else

Value = theData(Row, Field)

End If

End Sub

Example in Visual Basic (Safe Array)

Private Sub AddData_Click()

' Dim the array that will hold my data

Dim MyData(5 To 10, 2 To 4) As Variant

' Now populate the array

MyData(5, 2) = "ny"

MyData(6, 2) = "ny"

MyData(7, 2) = "ca"

MyData(8, 2) = "tx"

MyData(9, 2) = "nc"

MyData(10, 2) = "sc"

MyData(5, 3) = 100

46 MapX Reference

Page 61: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSets.Add method (DataSets collection)

MyData(6, 3) = 300

MyData(7, 3) = 123

MyData(8, 3) = 345

MyData(9, 3) = 455

MyData(10, 3) = 1231

MyData(5, 4) = 10000

MyData(6, 4) = 2000000

MyData(7, 4) = 30000

MyData(8, 4) = 12300

MyData(9, 4) = 34500

MyData(10, 4) = 45500

' add a dataset

Map1.Datasets.Add miDatasetSafeArray, MyData

' create a default theme

Map1.Datasets(1).Themes.Add

End Sub

Example in C++

void CSampleProjectView::AddSet(CDaoRecordset& rs) {

// This sample demonstrates the simplest use of the

// Datasets.Add method. With this usage, you specify only the

// data source and type. MapX automatically determines which

// column represents the geographic information, as well as

// which layer to bind that information to. Also demonstrated

// here is the simplest use of the Themes.Add method. In this

// usage, where all arguments are omitted, MapX automatically

// determines a name for the theme, which column to use to

// create the theme, and what type of theme to create. In

// this case, MapX will create a ranged theme on the first

// numeric column in the USA table (TOTPOPHIS)

// This example assumes you have a DAO recordset of valid data

// open in the rs parameter

COleVariant rsVariant;

CMapXDataset ds;

rsVariant.vt = VT_DISPATCH;

rsVariant.pdispVal = rs.m_pDAORecordset;

Mapx Referenc 47

Page 62: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSets.Add method (DataSets collection)

try {

// Create a dataset named "Dataset1"

ds = m_Map.GetDatasets().Add(miDataSetDAO,rsVariant);

// Create the default theme on the dataset

ds.GetThemes().Add();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

// This sample uses Datasets.Add and the RequestData event to

// build an unbound dataset, which allows MapX to access data

// whose format is known only to the programmer.

struct StateData { char name[3]; int value; };

StateData MapData[3] = {

{"ME",100},

{"NH",200},

{"VT",300}};

void CSampleProjectView::Start() {

COleVariant FieldsVariant;

CMapXFields flds;

CMapXDataset ds;

// Create a new, empty fields collection

if(!flds.CreateDispatch(flds.GetClsid())) {

TRACE0("Failed to Create Fields Collection");

return;

}

try {

flds.Add(COleVariant("State"),COleVariant("State"), COleVariant((long)miAggregationIndividual), COleVariant((long)miTypeString));

48 MapX Reference

Page 63: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSets.Add method (DataSets collection)

flds.Add(COleVariant("Value"),COleVariant("Value"), COleVariant((long)miAggregationSum),COleVariant((long)miTypeNumeric));

FieldsVariant.vt = VT_DISPATCH;

FieldsVariant.pdispVal = flds.m_lpDispatch;

ds = m_Map.GetDatasets().Add(miDataSetUnbound, COptionalVariant(),COleVariant("My Dataset"),COleVariant("State"),COptionalVariant(), COleVariant("USA"),FieldsVariant,COptionalVariant());

ds.GetThemes().Add(miThemeGradSymbol,"Sales","My Theme");

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

void CSampleProjectView::OnRequestData(LPCTSTR DataSetName, long Row, short Field, VARIANT FAR* Value, BOOL FAR* Done) {

*Done = FALSE;

if(!strcmp(DataSetName,"My Dataset") || Row > 3)

*Done = TRUE;

else {

if(Field == 1) {

Value->vt = VT_BSTR;

Value->bstrVal = CString(MapData[Row].name). AllocSysString();

} else {

Value->vt = VT_INT;

Value->iVal = MapData[Row].value;

}

}

}

See Also

ResolveDataBind event

Field object and Fields collection

Mapx Referenc 49

Page 64: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSets.Count property (DataSets collection)

DataSets.Count property (DataSets collection)

Purpose

The number of DataSet objects in the collection. This is a read-only property

Example in Visual Basic

Dim iCount as Integer

iCount = Map1.Datasets.Count

Debug.Print "There are " & iCount & "Datasets attached to _

the map."

- or -

Debug.Print "There are " & Map1.Datasets.Count & "Datasets _

attached" _ & " to the map."

Example in C++

void CSampleProjectView::CountDataset() {

CString msg;

try {

msg.Format("There are %d Datasets attached to the map.",m_Map.GetDatasets().GetCount());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

AfxMessageBox(msg);

}

// Datasets.Item Property

CMapXDataset CSampleProjectView::GetMyDataset() {

try {

return m_Map.GetDatasets().Item("My Dataset");

50 MapX Reference

Page 65: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSets.Item property (DataSets collection)

// or return m_Map.GetDatasets().Item(1);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

DataSets.Item property (DataSets collection)

Purpose

Retrieve a particular DataSet object from a collection. This is a Variant, and you can specify the Dataset name or 1 based index number. This is the default property for the DataSets collection.

Example(s)

Visual Basic:

Dim ds As Dataset

Set ds = Map1.Datasets("My Dataset") or Set ds = Map1.Datasets(1)

Delphi:

Var ds : variant;

Begin

ds := Map1.Datasets.Item("MyDataset"); or ds :=

Map1.Datasets.Item(1);

End;

DataSets.Remove method (DataSets collection)

Purpose

Removes a specified DataSet object from the DataSet collection.

Note: If you remove an item, the collection indexes are renumbered to fill in the hole left by the item removed.

Mapx Referenc 51

Page 66: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSets.RemoveAll method (DataSets collection)

Syntax

DataSets.Remove (index)

Remarks

All themes based off this dataset are removed as well.

Example in Visual Basic

Map1.Datasets.Remove "My Dataset"

- or -

Map1.Datasets.Remove 1

Example in C++

void CSampleProjectView::RemoveMyDataset() {

try {

m_Map.GetDatasets().Remove("My Dataset");

// or m_Map.GetDatasets().Remove(1);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

DataSets.RemoveAll method (DataSets collection)

Purpose

Removes all Dataset objects from the collection.

Syntax

DataSets.RemoveAll

Part Description

index DataSet name or 1 based index number.

52 MapX Reference

Page 67: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSets.RemoveAll method (DataSets collection)

Example in Visual Basic

Private Sub btnDatasetsRemoveAll_Click()

Dim nDataSets As Integer

Dim ds As Dataset

nDataSets = Map1.Datasets.Count

Set ds = Map1.Datasets.Add(miDataSetLayer, Map1.Layers(1))

nDataSets = Map1.Datasets.Count

' remove all of the datasets

Map1.Datasets.RemoveAll

End Sub

Example in C++

void CSampleProjectView::RemoveAllDatasets() {

CMapXLayer lyr;

COleVariant lyrVariant;

CMapXDataset ds;

try {

lyr=m_Map.GetLayers().Item(1);

lyrVariant.vt = VT_DISPATCH;

lyrVariant.pdispVal = lyr.m_lpDispatch;

// Add a dataset from a layer

m_Map.GetDatasets().Add(miDataSetLayer,lyrVariant);

// Now remove all datasets

m_Map.GetDatasets().RemoveAll();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Mapx Referenc 53

Page 68: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataSets.RemoveAll method (DataSets collection)

54 MapX Reference

Page 69: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Datum object

Datum object

A Datum object represents the Datum used by a CoordSys object. A datum is a singular mathematical description of the earth's shape and orientation.

Object Methods• Datum.Set method• Datum.SetFromList method

Object Properties• Datum.Eccentricity property• Datum.Ellipsoid property• Datum.Flattening property• Datum.PrimeMeridian property• Datum.RotateX, RotateY, RotateZ properties• Datum.ScaleAdjust property• Datum.SemiMajorAxis, SemiMinorAxis properties• Datum.ShiftX, ShiftY, ShiftZ properties

Remarks

All properties are read-only. To modify a Datum, use the Set method or the SetFromList method.

To obtain a Datum object, reference a CoordSys object's Datum property

Datum.Eccentricity property (Datum object)

Purpose

Read-only property; returns a Double value representing the datum's eccentricity

Remarks

In equations, eccentricity is usually represented by the letter "e".

Datum.Ellipsoid property (Datum object)

Purpose

Read-only property; returns a short value that identifies the datum's ellipsoid, such as 28 for "WGS 84."

Mapx Referenc 55

Page 70: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Datum.Flattening property (Datum object)

Datum.Flattening property (Datum object)

Purpose

Read-only property; returns a Double value representing the datum's flattening.

Remarks

In equations, flattening is usually represented by the letter f.

Datum.PrimeMeridian property (Datum object)

Purpose

Read-only property; returns a Double value representing the longitude of the datum's prime meridian, in degrees east of Greenwich.

Remarks

The PrimeMeridian property is usually zero, because most datums use Greenwich as the prime meridian. However, some datums use a different location as the prime meridian. For example, the NTF datum uses Paris as its prime meridian, which is 2.33722917 degrees east of Greenwich. If you use the NTF datum in a coordinate system, all longitudes in that coordinate system are relative to Paris instead of Greenwich.

Datum.RotateX, RotateY, RotateZ properties (Datum object)

Purpose

Read-only properties; return Double values representing the angle, in arc-seconds, to rotate the datum's ellipsoid around each of its axes.

Datum.ScaleAdjust property (Datum object)

Purpose

Read-only property; returns a Double value representing the datum's scale correction factor (the amount, in parts per million, to adjust the size of the ellipsoid).

Remarks

In equations, the scale adjustment is usually represented by the letter m.

56 MapX Reference

Page 71: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Datum.SemiMajorAxis, SemiMinorAxis properties (Datum object)

Datum.SemiMajorAxis, SemiMinorAxis properties (Datum object)

Purpose

Read-only properties; return Double values representing the datum's semi-major and semi-minor axes. Length is in meters..

Remarks

In equations, semi-major axis is usually represented by the letter a, and semi-minor axis is usually represented by the letter b.

Datum.Set metho (Datum object)

Purpose

Sets the properties that make up a Datum object.

Syntax

OBJECT Set (Ellipsoid, ShiftX, ShiftY, ShiftZ, RotateX, RotateY, RotateZ, ScaleAdjust, PrimeMeridian)

Remarks

All arguments are required.

See Also

Datum.SetFromList method

Part Description

OBJECT A Datum object.

Ellipsoid A short value; must be one of the supported ellipsoid numbers (such as 28 for the “WGS 84” ellipsoid).

ShifX, ShiftY, ShiftZ Double values, representing the distance (in meters) to shift the ellipsoid along each of its axes.

RatateX, RotateY, RotateZ Double Values, representing the angle (in arc-seconds) to rotate the ellipsoid around each of its axes.

ScaleAdjust Double value, representing a scale correction factor (the amount, in parts per million, to adjust the size of the ellipsoid).

PrimeMeridian Double value, representing the longitude of the prime meridian. Usually zero; see the PrimeMeridian property

Mapx Referenc 57

Page 72: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Datum.SetFromList method (Datum object)

Datum.SetFromList method (Datum object)

Purpose

Sets all of the properties of a Datum object to match the values of one of the datums in the list of datums.

Syntax

OBJECT.Set DatumNumber

Datum.ShiftX, ShiftY, ShiftZ properties (Datum object)

Purpose

Read-only properties; return Double values indicating the distance (in meters) to shift the datum's ellipsoid along each of its axes.

Part Description

OBJECT A Datum object.

DatumNumber A short value; must be one of the supported datum numbers (such as 62 for the “NAD 27” datum for the continental US).

58 MapX Reference

Page 73: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature object and Features collection

Each Layer has a collection of selected Feature objects (Layer.Selection). The selection is a collection of feature objects. Feature objects correspond to features (actual entities) in a layer, such as New York or Chicago.

Note: If a map feature is selected that exists over another object in another layer that also gets selected, the original feature does not appear to be selected. For example, in the "World Countries" geoset, select the United States and then, holding down the control key, select the ocean. The United States does not appear to be selected. Both items, however, will be in the Selection Collections for their respective layers.

The Features collection object represents a collection of Feature objects from a layer. All features in a collection must be from the same layer. You can get a features object by calling one of the Layer Search methods which return a Features collection. The Features object contains the features that were in the layer when the Search method was called. Adding or removing features from the layer do not affect any feature collections that you may already have.

Object Properties• Feature.Area property (Feature object)• Feature.Bounds property (Feature object)• Feature.Caption property (Feature object)• Feature.CenterX property, CenterY property (Feature object)• Feature.FeatureID property (Feature object)• Feature.FeatureKey property (Feature object)• Feature.KeyValue property (Feature object)• Feature.LabelPoint property (Feature object)• Feature.Layer property (Feature object)• Feature.Length property (Feature object)• Feature.Name property (Feature object)• Feature.Nodes property (Feature object)• Feature.Parts property (Feature object)• Feature.Perimeter property (Feature object) • Feature.Point property (Feature object)• Feature.Smooth property (Feature object)• Feature.Style property (Feature object)• Feature.Type property (Feature object)

Object Methods• Feature.Attach method (Feature object)• Feature.Clone method (Feature object)• Feature.Offset method (Feature object)• Feature.Update method (Feature object)

Page 74: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature object and Features collection

Collection Properties• Features.Bounds property (Features collection)• Features.Count property (Features collection)• Features.Item property (Features collection)

Collection Methods• Features.Add method (Features collection)• Features.AddByID method (Features collection)• Features.Clone method (Features collection)• Features.Common method (Features collection)• Features.Remove method (Features collection)• Features.Replace method (Features collection)• Features.RemoveByID method (Features collection)

Example In Visual Basic

This Visual Basic example builds a Features collection by performing a radius search, then selects the features returned by the search.

Dim fs as Features

Dim pt As New MapXLib.Point

pt.Set -96.731, 39.728

set fs = map1.Layers(1).SearchWithinDistance(pt,_

5,miUnitMile,miSearchTypePartiallyWithin)

map1.Layers(1).Selection.Replace fs

Example in C++

void CSampleProjectView::SelectObjects50Miles() {

CMapXFeatures fs;

CMapXPoint pt;

if(!pt.CreateDispatch(pt.GetClsid())) {

TRACE0("Failed to Create Point object");

return;

}

try {

pt.Set(-96.731,39.728);

fs = m_Map.GetLayers().Item(1).SearchWithinDistance(pt,50,miUnitMile,miSearchTypePartiallyWithin);

m_Map.GetLayers().Item(1).GetSelection().Replace(fs);

} catch (COleDispatchException *e) {

e->ReportError();

60 MapX Reference

Page 75: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.Area property (Feature object)

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

See Also

Selection Collection

Feature.Area property (Feature object)

Purpose

A read-only property that returns the area of a region feature; not valid for other types of features.

Remarks

To control the units in which the area is returned, set the Map.AreaUnit property

Valid for Region. The value is in area units. If you modify a feature in a layer, and you have not yet performed an Update to save the changes, then this property returns a value based on the "modified" version of the object (the object as it exists in memory).

Feature.Attach metho (Feature object)

Purpose

Attaches a stand-alone feature to the map, so that the map's coordinate system applies to the feature.

Syntax

OBJECT.Attach (Map)

Remarks

When you create a stand-alone feature object, you must attach that feature object to the map before you reference any of its methods or properties. Attaching a feature to the map associates the map's coordinate system with the feature. However, if you create a stand-alone feature by calling methods of the FeatureFactory object, you do not need to call the Attach method.

Part Description

object A feature object.

Map A map object.

Mapx Referenc 61

Page 76: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.Attach method (Feature object)

Example in Visual Basic

The following Visual Basic example demonstrates how to attach a stand-alone feature object.

Dim f as new Feature

f.Attach Map1

f.Type = miFeatureTypeSymbol

f.Point.Set Map1.CenterX, Map1.CenterY

Map1.Layers(1).AddFeature f

Example in C++

The following C++ code example creates a new symbol or text feature. The Attach method is used to associate the map's coordinate system with the stand-alone feature.

// create a new text or symbol feature to our

// scratch layer in the ontoolused event handler,

// depending on which tool was used

void CSampleDlg::OnToolUsedMap1(short ToolNum, double X1, double Y1, double X2, double Y2, double Distance, BOOL Shift, BOOL Ctrl, BOOL FAR* EnableDefault)

{

if (ToolNum == MYTOOL_SYMBOL || ToolNum == MYTOOL_TEXT) {

try {

CMapXFeature f;

// create a new symbol or text feature

// first create the standalone feature object

f.CreateDispatch(f.GetClsid());

// attach standalone feature to map, as required in V3

f.Attach(m_ctrlMapX.GetDispatch());

if (ToolNum == MYTOOL_SYMBOL) {

f.SetType(miFeatureTypeSymbol);

}

else {

f.SetType(miFeatureTypeText);

f.SetCaption("Text");

}

// set the style and location of the feature

f.SetStyle(m_ctrlMapX.GetDefaultStyle());

f.GetPoint().Set(X1,Y1);

// now add it to our layer

62 MapX Reference

Page 77: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.Clone method (Feature object)

CMapXLayer layer = m_ctrlMapX.GetLayers().Item("scratch layer");

layer.AddFeature (f);

}

catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

}

catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

}

Feature.Clone method (Feature object)

Purpose

Make a copy of this feature as a new, stand-alone Feature object.

Syntax

[=Feature]Feature.Clone

Feature.Bounds property (Feature object)

Purpose

Returns a Rectangle object representing the geographic extents of the feature (its minimum bounding rectangle).

Example in C++

// Feature.Bounds Property

void CSampleProjectView::ViewNY() {

// Set the map view to view New York state

try {

CMapXFeature NYState = Map.GetLayers().Item("USA").GetFind().Search("NY");

// If FindRC returns an exact match

if(NYState.GetFindRC()%10==1)

m_Map.SetBounds(NYState.GetBounds());

Mapx Referenc 63

Page 78: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.Caption property (Feature object)

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub ViewNY()

' Set the Map view to view New York state

Dim NYState As MapXLib.FindFeature

Set NYState = Map1.Layers.Item("USA").Find.Search("NY")

If NYState.FindRC Mod 10 = 1 Then

Map1.Bounds = NYState.Bounds

End If

End Sub

Remarks

In earlier versions of MapX, this property was called MBR.

If you modify a feature in a layer, and you have not yet performed an Update to save the changes, then this property returns a value based on the "modified" version of the object (the object as it exists in memory).

Feature.Caption property (Feature object)

Purpose

A read-write string value, representing the text string that makes up a Text feature. Referencing this property causes an exception if the feature is not a Text feature.

Syntax

[= string] OBJECT.Caption

Example in Visual Basic

. Dim f As New Feature

Part Description

OBJECT A Feature object.

string A text string, up to 255 characters long.

64 MapX Reference

Page 79: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.Caption property (Feature object)

Dim fNew As Feature

' Add a new text object to layer 1

f.Attach Map1

f.Type = miFeatureTypeText

f.Point.Set Map1.CenterX, Map1.CenterY

f.Caption = "This is a text object"

Set fNew = Map1.Layers(1).AddFeature(f)

' Change the text caption

fNew.Caption = "Changed Text"

fNew.Update

Example in C++

void CSampleProjectView::TextFeatureCreate() {

CMapXFeature f,fNew;

// Create new feature

if(!f.CreateDispatch(f.GetClsid())) {

TRACE0("Failed to Create Feature object");

return;

}

try {

// Add the new text object to layer 1

f.SetType(miFeatureTypeText);

f.GetPoint().Set(m_Map.GetCenterX(),m_Map.GetCenterY());

f.SetCaption("This is a text object");

fNew = m_Map.GetLayers().Item(1).AddFeature(f);

// Now change the text caption

fNew.SetCaption("Changed Text");

fNew.Update();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

Mapx Referenc 65

Page 80: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.CenterX property, CenterY property (Feature object)

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

See Also

Feature Object

Feature.CenterX property, CenterY property (Feature object)

Purpose

Read-only double values that indicate the X and Y map coordinates of the feature's centroid.

Remarks

When you need to access a feature's centroid, you may find it easier to use the LabelPoint property, instead of using CenterX and CenterY

Feature.FeatureID property (Feature object)

Purpose

Returns the ID of the feature. Each feature in a layer contains a unique ID within the layer. This is an Integer value and is read-only. This is the default property for the Feature object.

Note: Although this property is still a part of MapX, it is recommended that you use the Feature.FeatureKey.

Feature.FeatureKey property (Feature object)

Purpose

Returns the Key of the feature. Each feature in a layer contains a unique key within the layer. This is a string value and is read-only. This is a replacement for Feature.FeatureID (which still works as it did before, but it is recommended that you use the FeatureKey property).

Note: The Key of a feature can be used as a parameter wherever FeatureID could be used.

66 MapX Reference

Page 81: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.KeyValue property (Feature object)

See Also

Selection.SelectByRegion method

Dataset.Value

Dataset.Sourcerows

Layer.Updatefeature method (can be used in place of target feature)

Layer.Deletefeature method (can be used in place of target feature)

Features.AddbyID method

Features.RemovebyID method

Selection.SelectByID method

Feature.KeyValue property (Feature object)

Purpose

This read/write string property is used to update or set a column (field) in the MapInfo table when adding or updating a feature or layer.

Example in C++

// Feature.KeyField Property

// Layer.KeyValue Property

void CSampleProjectView::ModifyByPoint(double X,double Y) {

// This example assumes that you have a layer named "Customer Layer"

// with a field named "CUST_NAME". If there is a feature underneath the point

// (X,Y), the CUST_NAME field is changed to "MapInfo Corp"

try {

CMapXLayer srcLayer = m_Map.GetLayers.Item("Customer Layer");

CMapXFeatures ftrsUnderPoint;

CMapXPoint pt;

if(!pt.CreateDispatch(pt.GetClsid()) {

TRACE0("Failed to Create Point object");

return;

}

pt.Set(X,Y);

// Find all of the features underneath the point (X,Y) in "Customer Layer"

Mapx Referenc 67

Page 82: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.KeyValue property (Feature object)

ftrsUnderPoint = srcLayer.SearchAtPoint(pt);

// Now, all feature.KeyValue changes will deal with the CUST_NAME field

srcLayer.SetKeyField("CUST_NAME");

for(long i=1;i<=ftrsUnderPoint.GetCount();i++) {

AfxMessageBox("Old Value: " + ftrsUnderPoint.Item(i).GetName() + "\nNew Value: MapInfo Corp");

// change the value in the table to "MapInfo Corp"

ftrsUnderPoint.Item(i).SetKeyValue("MapInfo Corp");

ftrsUnderPoint.Item(i).Update();

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub ModifyByPoint(X As Double,Y As Double)

' This example assumes that you have a layer named

'"Customer Layer"

' with a field named "CUST_NAME". If there is a feature

'underneath the point

' (X,Y), the CUST_NAME field is changed to "MapInfo Corp"

Dim srcLayer as MapXLib.Layer

Dim ftrsUnderPoint as MapXLib.Features

Dim pt As New MapXLib.Point

pt.Set X,Y

Set srcLayer = Map1.Layers.Item("Customer Layer")

' Find all of the features underneath the point (X,Y) in

'"Customer Layer"

Set ftrsUnderPoint = srcLayer.SearchAtPoint(pt)

' Now, all feature.KeyValue changes will deal with

68 MapX Reference

Page 83: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.LabelPoint property (Feature object)

'the CUST_NAME field

srcLayer.KeyField = "CUST_NAME"

For Each ftr in ftrsUnderPoint

MsgBox "Old Value: " & ftr.Name & " New Value: MapInfo _

Corp"

' change the value in the table to "MapInfo Corp"

ftr.KeyValue = "MapInfo Corp"

ftr.Update

Next

End Sub

Remarks

The field value that is set or retrieved is determined by the value of the KeyField property of the Layer that the feature is from. Although the property is a string property, the string will be converted to the proper type of the column when updating or inserting.

Only the most recent value of the KeyValue property is used when adding or updating a feature. That is if you set the KeyValue, change the layer's keyfield property to a different field and then set the keyvalue again, only the second value will be updated in the mapinfo table for that feature.

See Also

Layer.KeyField

Layer object

Feature.LabelPoint property (Feature object)

Purpose

Point object which is the location in map coordinates of the centroid (label point) of a feature.

See Also

Point object

Feature.Layer property (Feature object)

Purpose

A read only property that returns the Layer object the feature is from.

See Also

Layer object

Mapx Referenc 69

Page 84: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.Length property (Feature object)

Feature.Length property (Feature object)

Purpose

A read-only property that returns the length of a line feature, as a Double. Not valid for other types of features.

Example in C++

// Feature.Distance Method

void CSampleProjectView::FindDistance() {

// Use the Feature.Length method to find the total

// distance of all the roads that the user selected

CMapXSelection RoadsSelected;

double TotalDistance = 0;

long RoadCount;

CString msg;

try {

m_Map.SetMapUnit(miUnitMile);

RoadsSelected = m_Map.GetLayers().Item("US Highways").GetSelection();

RoadCount = RoadsSelected.GetCount();

for(long i=1;i<=RoadCount;i++) {

// for each individual road, add its length to the total

TotalDistance += RoadsSelected.Item(i).GetLength();

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

msg.Format("The total distance was %f miles",TotalDistance);

AfxMessageBox(msg);

}

70 MapX Reference

Page 85: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.Name property (Feature object)

Example in Visual Basic

Private Sub FindDistance_Click()

' Use the Feature.Length property to find the total distance

' of all the roads that the user selected

Dim RoadsSelected As Selection

Dim TotalDistance as Double

Dim Road as Feature

TotalDistance = 0

Map1.MapUnit = miUnitMile

Set RoadsSelected = Map1.Layers.Item("US Highways").Selection

For Each Road In RoadsSelected

TotalDistance = TotalDistance + Road.Length

Next

MsgBox "The total distance was " & TotalDistance & " miles"

End Sub

Remarks

To control the units in which the length is returned, set the Map.MapUnit property

If you modify a feature in a layer, and you have not yet performed an Update to save the changes, then this property returns a value based on the "modified" version of the object (the object as it exists in memory).

See Also

Feature.Perimeter

Feature.Name property (Feature object)

Purpose

Read-only property that returns the feature name. The feature name is value of the LabelProperties.DataField field (which also appears as the feature's label).

See Also

LabelProperties.DataField property

Mapx Referenc 71

Page 86: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.Nodes property (Feature object)

Feature.Nodes property (Feature object)

Purpose

This read-only property exposes the node data in such a way that the user can query for all the nodes in an object with one pass, then have them returned in a single, contiguous block of memory.

Syntax

[ SafeArray= ] OBJECT Nodes ([CSys])

Example

The following example attempts to illustrate the layout of the safe array. Assume that Arr is the array returned from a call to Nodes on a feature that is a poly-polyline consisting of two segments, where the first segment contains 3 nodes and the second segment contains 2 nodes.

//Arr is a 7 x 2 array

Arr(1,1) = # of nodes in the segment 1 (in this case 3)

Arr(2,1) = X Coord of segment 1, node 1

Arr(3,1) = Y Coord of segment 1, node 1

Arr(4,1) = X Coord of segment 1, node 2

Arr(5,1) = Y Coord of segment 1, node 2

Arr(6,1) = X Coord of segment 1, node 3

Arr(7,1) = Y Coord of segment 1, node 3

Arr(1,2) = # of nodes in the segment 2 (in this case 2)

Arr(2,2) = X Coord of segment 2, node 1

Arr(3,2) = Y Coord of segment 2, node 1

Arr(4,2) = X Coord of segment 2, node 2

Arr(5,2) = Y Coord of segment 2, node 2

Arr(6,2) = Undefined

Arr(7,2) = Undefined

Parts Description

OBJECT Represents a place holder for a Feature object.

CSys A CoordSys object which defines the Coordinate System that the node data is returned in. The default is Map.NumericCoordSys

72 MapX Reference

Page 87: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.Nodes property (Feature object)

Example in Visual Basic

// The following VB Code will print all the nodes for the first

// object in a selection on the USA layer to the debug window.

Private Sub Command2_Click()

Dim arrVals As Variant

Dim obj As MapXLib.Feature

Dim iNodeCnt As Integer

Dim NodesLBound As Integer

Dim NodesUBound As Integer

Set obj = Map1.Layers("USA").Selection(1)

arrVals = obj.Nodes

NodesLBound = LBound(arrVals, 1)

NodesUBound = UBound(arrVals, 1)

PolysLBound = LBound(arrVals, 2)

PolysUBound = UBound(arrVals, 2)

For i = PolysLBound To PolysUBound

Debug.Print "Begin Poly #"; i

iCoordCnt = arrVals(NodesLBound, i) * 2

For j = NodesLBound + 1 To iCoordCnt Step 2

Debug.Print "Pt#"; j / 2; "("; arrVals(j, i); ","; arrVals(j + 1, i); ")"

Next j

Debug.Print "End Poly #"; i

Debug.Print ""

Next i

End Sub

Mapx Referenc 73

Page 88: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.Offset method (Feature object)

Feature.Offset metho (Feature object)

Purpose

Moves the feature relative to its current position.

Syntax

OBJECT.Offset (deltaX, deltaY)

Feature.Parts property (Feature object)

Purpose

A read-only property that returns a Parts object. Valid for Lines or Regions.

See Also

Parts object

Feature.Perimeter property (Feature object)

Purpose

A read-only property that returns the perimeter of a region feature; not valid for other types of features.

Remarks

To control the units in which the perimeter is returned, set the Map.MapUnit property

If you modify a feature in a layer, and you have not yet performed an Update to save the changes, then this property returns a value based on the "modified" version of the object (the object as it exists in memory).

See Also

Feature.Length

Parts Description

OBJECT Represents a place holder for a Feature object.

deltaX The map coordinates to move the point by.

deltaY The map coordinates to move the point by.

74 MapX Reference

Page 89: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.Point property (Feature object)

Feature.Point property (Feature object)

Purpose

This read-only property returns a Point object. Valid only for features of type point and text.

See Also

Point object

Feature.Smooth property (Feature object)

Purpose

The Feature.Smooth object enables you to smooth a polyline, making it into a continuous curve. To smooth a polyline set the property to True.

Feature.Style property (Feature object)

Purpose

This read/write property returns the style of the feature.

See Also

Style object

Remarks

Style object default is '0' for each property of style object.

Feature.Type property (Feature object)

Purpose

Contains the type of the feature. This is a FeatureTypeConstants value, and is read/write.

Example

Dim f As New Feature

DimfNew As Feature

'Add a new text object to layer 1

f.Attach Map1

f.Type = miFeatureTypeText

f.Point.Set Map1.CenterX, Map1.CenterY

Mapx Referenc 75

Page 90: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.Update method (Feature object)

f.Caption = Map1.Layers(1).AddFeature(f)

'Change the text caption

fNew.Caption = “Changed Text”

fNew.Update

See Also

FeatureFactory.CreateText

Feature.Update method (Feature object)

Purpose

Update the layer with changes made to the Feature object.

Syntax

[boolean=] OBJECT.Update ( [UpdateFeature] , [RowValues] )

Note: The object column stores the geographic data for the Feature object.

Example inC++

// Feature.Offset Method

// Feature.Update Method

// define DRAG_TOOL_ID 40

void CSampleProjectView::OnCreate() {

// ...

m_Map.CreateCustomTool(DRAG_TOOL_ID,miToolTypeLine,miSizeAllCursor);

// ...

}

void CSampleProjectView::OnToolUsed(short ToolNum, double X1, double Y1, double X2, double Y2, double Distance, BOOL Shift, BOOL Ctrl, BOOL* EnableDefault)

{

if(ToolNum==DRAG_TOOL_ID) {

Parts Description

OBJECT Represents a place holder for a Feature object.

UpdateFeature Boolean value that indicates whether or not to update the object column. Its default is true.

RowValues Represents the new values of the data.

76 MapX Reference

Page 91: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.Update method (Feature object)

// Offset the feature underneath the mouse by however much the user dragged

// This example gets the features from a layer named "My Layer"

// All of the changes are permanent and cannot be undone; do not use this on

// any permanent layers unless you wish to permanently alter the map layer

CMapXPoint pt;

CMapXFeatures FtrsUnderPt;

if(!pt.CreateDispatch(pt.GetClsid())) {

TRACE0("Couldn't Create Point object");

return;

}

try {

pt.Set(X1,Y1);

FtrsUnderPt = m_Map.GetLayers().Item("My Layer").SearchAtPoint(pt);

// Take the first item in the collection,even if there are more than one

// We do this because if there are two items on top of each other, they

// would be inseparable if all the items returned by SearchAtPoint were used

// This way, only one of them is moved, and the user will be able to move

// one off of the other

if(FtrsUnderPt.GetCount()>=1) {

CMapXFeature ftr = FtrsUnderPt.Item(1);

ftr.Offset(X2-X1,Y2-Y1);

ftr.Update();

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

}

Mapx Referenc 77

Page 92: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Feature.Update method (Feature object)

Example in Visual Basic

Const DRAG_TOOL_ID = 40

Private Sub Form_Load()

' ...

Map1.CreateCustomTool DRAG_TOOL_ID,miToolTypeLine,miSizeAllCursor

' ...

End Sub

Private Sub Map1_ToolUsed(ByVal ToolNum As Integer, ByVal X1 _

As Double, ByVal Y1 As Double, ByVal X2 As Double, ByVal Y2 _

As Double, ByVal Distance As Double, ByVal Shift As Boolean, _

ByVal Ctrl As Boolean, EnableDefault As Boolean)

If ToolNum = DRAG_TOOL_ID Then

' Offset the feature underneath the mouse by however much

' the user dragged

' This example gets the features from a layer named "My

' Layer"

' All of the changes are permanent and cannot be undone;

' do not use this on

' any permanent layers unless you wish to permanently

' alter the map layer

Dim pt As New MapXLib.Point

Dim FtrsUnderPt As MapXLib.Features

Dim ftr As MapXLib.Feature

pt.Set X1, Y1

Set FtrsUnderPt = Map1.Layers.Item("My Layer").SearchAtPoint(pt)

' Take the first item in the collection,even if there

' are more than one

' We do this because if there are two items on top of

' each other, they

' would be inseparable if all the items returned by

' SearchAtPoint were used

' This way, only one of them is moved, and the user

' will be able to move

' one off of the other

If FtrsUnderPt.Count = 1 Then

Set ftr = FtrsUnderPt.Item(1)

ftr.Offset X2 - X1, Y2 - Y1

78 MapX Reference

Page 93: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Features.Add method (Features collection)

ftr.Update

End If

End If

End Sub

Features.Add method (Features collection)

Purpose

Add a Feature object or all features from a Features object into the collection. (UNION set operation).

Syntax

OBJECT Add (Source)

Example in Visual Basic

' Select every state which contains a Top 20 city.

Dim ftr As Feature

Dim ftrs As Features

Dim usaLayer As Layer

Set usaLayer = Map1.Layers.Item("USA")

Set ftrs = usaLayer.NoFeatures

For Each ftr In Map1.Layers.Item("US Top 20 Cities").AllFeatures

ftrs.Add usaLayer.SearchAtPoint(ftr.Point)

Next

usaLayer.Selection.Replace ftrspn

See Also

Feature object and Features collection

Part Description

OBJECT Represents a place holder for a Features object.

Source A Feature object or Features collection to add to the Features collection in OBJECT

Mapx Referenc 79

Page 94: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Features.AddByID method (Features collection)

Features.AddByID method (Features collection)

Purpose

Add a Feature object with the specified FeatureKey to the Features collection.

Syntax

OBJECT AddByID (FeatureKey)

Note: Feature.FeatureKey is a replacement for Feature.FeatureID. FeatureID still works as it did before, but it is recommended that you use the new FeatureKey property.

See Also

Feature.FeatureKey property

Features.Bounds property (Features collection)

Purpose

Returns a Rectangle object representing the geographic extents of all objects in the collection (i.e. the minimum bounding rectangle).

Syntax

OBJECT Bounds

The OBJECT placeholder represents a Features collection.

Example in C++

// Features.Bounds Property

void CSampleProjectView::ViewSelection(CMapXLayer lyr) {

// set the map to view the current selection

CMapXFeatures selectedFeatures;

try {

selectedFeatures = lyr.GetSelection().Clone();

m_Map.SetBounds(selectedFeatures.GetBounds());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

Part Description

OBJECT Represents a place holder for a Features object.

FeatureKey FeatureKey of the feature to add to the Features collection.

80 MapX Reference

Page 95: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Features.Clone method (Features collection)

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub ViewSelection(lyr As MapXLib.Layer)

' set the map to view the current selection

Dim selectedFeatures As Features

Set selectedFeatures = lyr.Selection.Clone

Map1.Bounds = selectedFeatures.Bounds

End Sub

Remarks

This property is useful if you want to zoom the map out far enough to show all objects in the collection.

Features.Clone metho (Features collection)

Purpose

Make a copy of the collection as another Features object.

Syntax

OBJECT.Clone (source)

Features.Common method (Features collection)

Purpose

Combine this collection and another Features object so that this collection contains only features that are in both. (INTERSECT set operation).

Parts Description

OBJECT Represents a place holder for a Features collection.

source This represents the set of features to be cloned with the collection, OBJECT

Mapx Referenc 81

Page 96: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Features.Count property (Features collection)

Syntax

OBJECT.Common (source)

Example in Visual Basic

' Select every state that is within 500 miles of New Jersey AND

' within 500 miles of the point that was clicked.

Private Sub Map1_ToolUsed(ByVal ToolNum As Integer, ByVal X1 As Double, ByVal Y1 As Double, ByVal X2 As Double, ByVal Y2 As Double, ByVal Distance As Double, ByVal Shift As Boolean, ByVal Ctrl As Boolean, EnableDefault As Boolean)

If ToolNum = MY_TOOL Then

Dim ftrs As Features

Dim newJersey As Feature

Dim usaLayer As Layer

Dim pt As New Point

pt.Set X1, Y1

Set usaLayer = Map1.Layers.Item("USA")

Set newJersey = usaLayer.Find.Search("NJ")

Set ftrs = usaLayer.SearchWithinDistance(pt, 500, miUnitMile, miSearchTypePartiallyWithin)

ftrs.Common usaLayer.SearchWithinDistance(newJersey, 500, miUnitMile, miSearchTypePartiallyWithin)

usaLayer.Selection.Replace ftrs

End If

End Sub

Features.Count property (Features collection)

Purpose

Number of items in the collection.

Parts Description

OBJECT Represents a place holder for a Features collection.

source This represents the set of features to be combined with the collection, OBJECT

82 MapX Reference

Page 97: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Features.Item property (Features collection)

Features.Item property (Features collection)

Purpose

Return a Feature object from collection - currently only numeric indexes are supported. This is a default property for the Features collection.

Features.Remove method (Features collection)

Purpose

Remove a Feature object or all features from a Features object from this collection. (SUBTRACT set operation).

Syntax

OBJECT Remove (source)

Example in Visual Basic

' Select every state which _does not_ contain a Top 20 city.

Dim usaLayer As Layer

Dim ftrs As Features

Dim ftr As Feature

Set usaLayer = Map1.Layers.Item("USA")

Set ftrs = usaLayer.AllFeatures

For Each ftr In Map1.Layers.Item("US Top 20 Cities").AllFeatures

ftrs.Remove usaLayer.SearchAtPoint(ftr.Point)

Next

usaLayer.Selection.Replace ftrs;

Parts Description

OBJECT Represents a place holder for a Features object.

source This represents the set of features to be removed from the collection, OBJECT

Mapx Referenc 83

Page 98: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Features.RemoveByID method (Features collection)

Features.RemoveByID method (Features collection)

Purpose

Remove a Feature object with the specified FeatureID from the Features collection.

Syntax

OBJECT RemoveByID (*FeatureKey)

Features.Replace method (Features collection)

Purpose

This replaces the contents of the collection with a Feature object or all features from a Features object.

Syntax

OBJECT.Replace (source)

Part Description

OBJECT Represents a place holder for a Features object.

FeatureKey *FeatureKey of the feature to remove from the Features collection. This is a replacement for FeatureID parameter. FeatureID still works as it did before, but it is recommended that you use the new FeatureKey parameter.

Parts Description

OBJECT Represents a place holder for a Features object.

source Represents a feature object or features collection, the contents of which will replace the contents of "feature".

84 MapX Reference

Page 99: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory object

This object lets you create new map features, or create features by performing operations (such as buffering) on existing features.

Object Methods• FeatureFactory.BufferFeatures method (FeatureFactory object)• FeatureFactory.CombineFeatures method (FeatureFactory object)• FeatureFactory.CreateArc method (FeatureFactory object)• FeatureFactory.CreateCircularRegion method (FeatureFactory object)• FeatureFactory.CreateEllipticalRegion method (FeatureFactory object)• FeatureFactory.CreateLine method (FeatureFactory object)• FeatureFactory.CreateRegion method (FeatureFactory object)• FeatureFactory.CreateSymbol method (FeatureFactory object)• FeatureFactory.CreateText method (FeatureFactory object)• FeatureFactory.EraseFeature method (FeatureFactory object)• FeatureFactory.IntersectFeatures method (FeatureFactory object)• FeatureFactory.IntersectionPoints method (FeatureFactory object)• FeatureFactory.IntersectionTest method (FeatureFactory object)

Remarks

Most of these methods return stand-alone feature objects. These feature objects are automatically attached to the map (i.e. they already have an associated coordinate system). In other words, you do not need to use the Attach method on the features returned by these methods.

To obtain a FeatureFactory object, reference the Map.FeatureFactory property

Example in Visual Basic

Dim f As MapXLib.Feature

Dim p As New MapXLib.Point

' Use the map's current center as the point coordinates

' p.Set Map1.CenterX, Map1.CenterY

' Create a text feature and add it to layer 1

Set f = Map1.Layers(1).AddFeature(Map1.FeatureFactory. _

CreateText(p, "Some Text"))

Page 100: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.BufferFeatures method (FeatureFactory object)

Example in C++

void CSampleProjectView::FeatureFactoryTextCreate() {

CMapXFeature ftr;

CMapXPoint pnt;

COleVariant pntVt;

if(!pnt.CreateDispatch(pnt.GetClsid())) {

TRACE0("Failed to Create Point object");

return;

}

try {

// Use the map's current center as the point's coordinates

pnt.Set(m_Map.GetCenterX(),m_Map.GetCenterY());

pntVt.vt = VT_DISPATCH;

pntVt.pdispVal = pnt.m_lpDispatch;

// Create a text feature and add it to layer 1

ftr = m_Map.GetLayers().Item(1).AddFeature(m_Map.GetFeatureFactory().CreateText(pntVt,"Some Text"));

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

FeatureFactory.BufferFeatures metho (FeatureFactory object)

Purpose

Returns a stand-alone Feature object representing a buffer region.

86 MapX Reference

Page 101: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.BufferFeatures method (FeatureFactory object)

Syntax

OBJECT BufferFeatures ( Source, Distance, [Units] , [Resolution] )

Remarks

This method returns a single buffer region, regardless of whether you base the buffer on one Feature or a Features collection. If you want to create a separate buffer region for each feature in the collection, you must loop through the collection and use the BufferFeatures method on one feature at a time.

If you are creating a buffer for the sole purpose of performing a search within the buffer, you can use the SearchWithinDistance method instead of the BufferFeatures method.

The resolution argument controls how many nodes are in the buffer region. Resolution is specified in terms of the number of nodes per circle; this is best illustrated by example. The picture at the left shows two features: A black, L–shaped polyline, and a gray buffer region. The region was produced by creating a buffer around the polyline. In this illustration, a small square marks the location of each node in the buffer region. This buffer was produced using a resolution of 12 nodes per circle. Note that each end of the polyline is capped with a semi–circle, and each semi–circle consists of six segments. If a larger resolution had been used, there would be more nodes in each semi–circle.

Note that the resolution does not necessarily represent the total number of nodes in the feature.

Part Description

OBJECTt A FeatureFactory object.

Source A Feature object or a Features collection object. Point, line, and region features can be buffered; text features cannot be buffered.

Distance The size of the buffer, in units specified by the units argument. If the distance is positive, the buffer region is larger than the source feature(s). When buffering a region, you can specify a negative distance, which produces a buffer region that is smaller than the source region.

Units Variant: A MapUnitConstants value, such as miUnitMile (0), that identifies the unit of measure for the distance argument. If omitted, the MapUnit property is used as the default

Resolution Variant: A positive integer indicating the number of nodes used in creating a buffer. This is the number of nodes per circle in a buffer operation, not the total number of nodes for the entire region (see below). If omitted, the resolution is controlled by the DefaultConversionResolution property.

Mapx Referenc 87

Page 102: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.CombineFeatures method (FeatureFactory object)

Resolution is specified in terms of nodes per circle, and a given feature can contain many semi–circles. For example, the buffer region shown above has more than 12 nodes, although the resolution specified 12 nodes per circle. Specifying a large resolution produces a smoother looking region, but it takes longer to generate, and the resulting object requires more storage space.

See Also

FeatureFactory.CreateCircularRegion method

FeatureFactory.CombineFeatures method (FeatureFactory object)

Purpose

Returns a stand-alone Feature object representing the combination (union) of multiple line features or multiple region features.

Syntax

OBJECT CombineFeatures( feature1 [ , feature2 ] )

Remarks

If feature1 is a Features collection, then the feature2 argument is optional. If feature1 is a Feature object, then the feature2 argument is required. You cannot combine a line feature with a region feature. The following combinations are supported:

• You can combine two or more line features (features whose Type property is miFeatureTypeLine), in which case the result is a line feature.

• You can combine two or more region features (type: miFeatureTypeRegion), in which case the result is a region feature.

Part Description

object A FeatureFactory object

feature1 A Feature object or a Features collection object.

feature2 Variant: A Feature object or a Features collection object.

88 MapX Reference

Page 103: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.CreateArc method (FeatureFactory object)

FeatureFactory.CreateArc metho (FeatureFactory object)

Purpose

Creates a line feature shaped like an arc, and returns it as a stand-alone Feature object.

Syntax

OBJECT CreateArc( Point1, Point2, [Angle] , [Distance] , [Resolution] , [Style] )

Remarks

This method returns a line feature (a feature whose Type property is miFeatureTypeLine) that is shaped like an arc. Note: If the current DisplayCoordSys does not match the current NumericCoordSys, the arc may appear distorted.

To calculate the path of the arc, imagine a line that connects Point1 and Point2 (the horizontal line in the diagram at the left).

Next, imagine a second line (the vertical line in the diagram) that begins at the center point of the first line. The length of the second line is determined by the Offset argument, and its angle relative to the first line is determined by the Angle argument. To make the second line perpendicular, as shown in the diagram, specify 90 degrees or 270 degrees. A triangle is defined by Point1, Point2, and the end point of the second line. This triangle acts as a ”control polygon” in that it controls the shape of the arc. The arc fits inside the triangle, and

Part Description

OBJECT A FeatureFactory object.

Point, Point2 Two Point objects, representing the starting and ending points of the arc.

Angle Variant: An angle, in degrees. Optional; if omitted, the default angle is 90 degrees, producing a symmetric arc.

Distance Variant: The length of an offset line expressed as a number of “arc units” (where one arc unit is the distance between Point1 and point2). The larger the value, the more bowed the arc appears. Specifying zero would produce a flat arc. Optional; if omitted, defaults to a value of 1.

Ressolution Variant: A positive integer indicating the number of nodes to use in creating the ellipse; maximum number is 32,763. Optional; if omitted, the defaultConversionResolution property controls the resolution.

Style Variant: A Style object that defines the appearance of the feature. Optional; if omitted, no style is set.

Mapx Referenc 89

Page 104: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.CreateArc method (FeatureFactory object)

it is tangential to the sides of the triangle at Point1 and Point2.The arc falls on one side of the line between Point1 and Point2. To make the arc fall on the opposite side of the line, use a different Angle argument (e.g. instead of 90 degrees, specify 270 degrees). Each combination of Angle and Offset values produces a unique, characteristic shape. If you always use the same combination of Angle and Offset values, the arcs produced will always have the same shape, regardless of the distance between Point1 and Point2. Some samples are shown below:

Angle Offset Result

30 1

30 0.5

90 1

90 0.5

90 0.25

165 1

165 0.5

90 MapX Reference

Page 105: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.CreateCircularRegion method (FeatureFactory object)

See Also

FeatureFactory.CreateEllipticalRegion method

FeatureFactory.CreateCircularRegion method (FeatureFactory object)

Purpose

Creates a region feature shaped like a circle, and returns it as a stand-alone Feature object. The feature can be added to a layer, used in searches, etc.

Syntax

OBJECT CreateCircularRegion( Type, Point, Distance, [Units] , [Resolution] , [Style] )

270 0.5

Angle Offset Result

Part Description

OBJECT A FeatureFactory object.

Type Short: A CircleTypeConstants value: Specify miCircleTypeScreen(value:0)or miCircleTypeMap (1). (See below)

Point Point object: Represents the location to use as the center of the circle; specified in the current numeric coordinate system.

Distance Double: The radius of the circle, in the units specified by the Units argument.

Units Variant: A MapUnitConstants value, such as miUnitMile (0), that identifies the unit of measure for the Distance argument. Optional; if omitted, the MapUnit property controls the Units.

Resolution Variant: A positive integer indicating the number of nodes to use in creating the circle; maximum number is 32,763. Optional; if omitted, the DefaultConversionResolution property controls resolution.Specifying a large resolution produces a smoother looking region, but it takes longer to generate, and the resulting object requires more storage space.

Style Variant: A Style object that defines the appearance of the feature. Optional; if omitted, no style is set.

Mapx Referenc 91

Page 106: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.CreateEllipticalRegion method (FeatureFactory object)

Remarks

If the Type is miCircleTypeScreen, MapX creates a region that appears circular on the screen. However, different points on the circle might not be the same geographic distance from the center of the circle. MapX calculates a point along the x-axis that is Distance units from the center. That distance is converted to screen units (pixels) and used as the radius to calculate the rest of the nodes in the circle. Note: If you change the map's display coordinate system after creating the region, the region may appear lop-sided, rather than circular.

If the Type is miCircleTypeMap, MapX creates a region whose points are all the same geographic distance from the center. However, due to the curvature of the earth, and due to the way that coordinate systems and map projections work, such a circle might appear lop-sided, rather than circular.

See Also

BufferFeatures method

CreateEllipticalRegion method

FeatureFactory.CreateEllipticalRegion method (FeatureFactory object)

Purpose

Creates a region feature shaped like an ellipse, and returns it as a stand-alone Feature object. The feature can be added to a layer, used in searches, etc.

Syntax

OBJECT CreateEllipticalRegion( Rectangle, [Angle] , [Resolution] , [Style] )

Part Description

OBJECT Represents a FeatureFactory object.

Rectangle A Rectangle object, representing the minimum bounding rectangle (MBR) of an ellipse in the map's current numeric coordinate system.

Angle Variant: An angle of rotation for the ellipse. The ellipse is rotated from its center point.

Resolution Variant: A positive integer indicating the number of nodes to use in creating the ellipse; maximum number is 32,763. If omitted, the DefaultConversionResolution property controls the resolution.

Style Variant: A Style object that defines the appearance of the feature. Optional; if omitted, no style is set.

92 MapX Reference

Page 107: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.CreateEllipticalRegion method (FeatureFactory object)

Example in C++

// 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);

m_Map.GetLayers().Item("Temp Layer").AddFeature(createdEllipse);

} catch(COleDispatchException* e) {

e->ReportError();

e->Delete();

} catch(COleException* e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub CreateEllipse()

' Create a new ellipse region and add it to a temporary

' features layer

Dim rect As New MapXLib.Rectangle

Dim createdEllipse As Feature

rect.Set Map1.CenterX, Map1.CenterY, Map1.CenterX

+ 30, Map1.CenterY + 10

Set createdEllipse = Map1.FeatureFactory.CreateElliptical _

Region(rect, 0, 24, Map1.DefaultStyle)

Map1.Layers.Item("Temp Layer").AddFeature createdEllipse

End Sub

Mapx Referenc 93

Page 108: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.CreateLine method (FeatureFactory object)

Remarks

If the current DisplayCoordSys does not match the current NumericCoordSys, the ellipse may appear distorted.

See Also

CreateArc method

CreateCircularRegion method

FeatureFactory.CreateLine method (FeatureFactory object)

Purpose

Returns a stand-alone Feature object (a line feature), built from a collection of points.

Syntax

OBJECT CreateLine( [Points] , [Style] )

FeatureFactory.CreateRegion method (FeatureFactory object)

Purpose

Returns a stand-alone Feature object (a region feature), built from a collection of points.

Part Description

OBJECT A FeatureFactory object.

Points Variant: A Points collection, representing the set of points to use to define the line. Optional; if omitted, no points are added to the line feature.

Style Variant: A Style object that defines the appearance of the feature. Optional; if omitted, no style is set.

94 MapX Reference

Page 109: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.CreateSymbol method (FeatureFactory object)

Syntax

OBJECT CreateRegion( [Points] , [Style] )

FeatureFactory.CreateSymbol method (FeatureFactory object)

Purpose

Returns a stand-alone Feature object (a point feature), built from a Point object.

Syntax

OBJECT CreateSymbol( [Point] , [Style] )

FeatureFactory.CreateText method (FeatureFactory object)

Purpose

Returns a stand-alone Feature object (a text feature).

Part Description

OBJECT A FeatureFactory object.

Points Variant: A Points collection, representing the set of points that define the region or a Rectangle object. Passing a Rectangle object creates a region using the four corners of the rectangle. Optional; if omitted, no points are added to the feature.

Style Variant: A Style object that defines the appearance of the feature. Optional; if omitted, no style is set.

Part Description

OBJECT A FeatureFactory object.

Point Variant: A Point object, representing the x/y location where the symbol should be placed. Optional; if omitted, the feature's location is not set.

Style Variant: A Style object that defines the appearance of the feature. If omitted, no style is set.

Mapx Referenc 95

Page 110: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.EraseFeature method (FeatureFactory object)

Syntax

OBJECT CreateText ( [Point] , [Caption] , [Position] , [Style] )

Remarks

You control the location of a text feature by specifying the Point and the Position. Note, howeverthat the Position property can only be used for specifying the initial position of the text; the Feature object does not provide a Position property that allows you to reset the text orientation. Once this method creates a text feature, there is no way to toggle the feature's orientation relative to the anchor point.

FeatureFactory.EraseFeature method (FeatureFactory object)

Purpose

Returns a stand-alone Feature object by "erasing" one feature's area from another feature.

Part Description

OBJECT A FeatureFactory object.

Point Variant: A Point object, representing the location where the text should be anchored. Optional; if omitted, the feature's location is not set.

Caption Variant: A string that defines the text. Optional; if omitted, the feature's caption is not set.

Position A PositionConstants value; controls the initial position of the text, relative to the anchor point. Optional; if omitted, defaults to miPositionTL (i.e. the anchor point is at the top left corner of the text). This argument only takes effect if the Point and Caption arguments are both specified.

Style Variant: A Style object that defines the appearance of the feature. If omitted, no style is set.

96 MapX Reference

Page 111: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.EraseFeature method (FeatureFactory object)

Syntax

OBJECT EraseFeature( SourceFeature, EraserFeature )

Remarks

This method creates a Feature object by subtracting the EraserFeature from the SourceFeature. If the two features do not intersect, then nothing is erased, and the feature returned by this method is identical to the SourceFeature.

Example

This picture shows a circular region, created through the BufferFeatures method. In this example, the circular region covers a coastal area; the gray area represents land, and the white area represents water

Part Description

OBJECT A FeatureFactory object.

SourceFeature A Feature object, part of which you want to erase; this can be a line feature or a region feature.

EraserFeature A Feature object, which represents the area that you want to remove from the SourceFeature. This must be a region feature.

Mapx Referenc 97

Page 112: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.EraseFeature method (FeatureFactory object)

To erase part of the circular region, use the EraseFeature method. If you make the circular region your SourceFeature, and make the gray region your EraserFeature, you will erase the portion of the circle that overlaps the gray region.

This picture shows what is left of the circular region after calling the EraseFeature method.

The EraseFeature method removes the portion of a feature that overlaps another feature. To perform the opposite task (to remove the portion of a feature that does not overlap), use the IntersectFeatures method.

98 MapX Reference

Page 113: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.IntersectFeatures method (FeatureFactory object)

FeatureFactory.IntersectFeatures method (FeatureFactory object)

Purpose

Returns a stand-alone feature that represents the intersection of multiple features.

Syntax

[Feature=]OBJECT IntersectFeatures( feature1 [feature2] )

Remarks

This method intersects a Feature or Features object with another Feature or Features object, and returns the resulting object as a stand-alone feature.

You cannot use point or text features with this method. Only the following combinations of feature types are supported:

• You can intersect regions with other regions. If regions overlap, the feature returned by this method is also a region.

• You can intersect regions and lines. Assuming that the region covers at least part of the line, the intersection is the portion of the line that is covered by the region.

• You can intersect lines with other lines. If two lines cross, IntersectFeatures will return a polyline feature with one point.

Note that two features might not intersect at all, in which case the value returned by this method is a polyline feature with zero points; such a feature cannot be inserted into a layer.

The IntersectFeatures method returns the portion of a feature that overlaps another feature. Tobtain the portion of a feature that does not overlap, use the EraseFeature method.

Part Description

OBJECT A FeatureFactory object.

feature1 A Feature object or a Features collection object, representing region or line features.

feature2 Variant: A Feature object or a Features collection object representing region or line features. This argument is only required if the feature1 argument is a single Feature object.

Mapx Referenc 99

Page 114: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.IntersectionPoints method (FeatureFactory object)

FeatureFactory.IntersectionPoints metho (FeatureFactory object)

Purpose

Returns a Points collection containing the points where two features intersect.

Syntax

OBJECT IntersectionPoints( feature1, feature2, [flag] )

Remarks

If the two features do not intersect, the Points collection produced by this method is empty.

The flag argument can be any of the three IntersectionPointConstants values, described below.

FeatureFactory.IntersectionTest method (FeatureFactory object)

Purpose

Returns a Boolean value, indicating whether two features satisfy a test of intersection.

Part Description

object A FeatureFactory object.

feature1 A Feature object.

feature2 A Feature object.

flag Variant: An IntersectionPointConstants value; see below. Optional; if omitted, the default is miIntersectAll.

Setting Value Description

miIntersectCrossings 9 Returns the set of points where a line segment from one feature crosses a line segment from the other feature, but the features do not have nodes at the point of crossing.

miIntersectCommon 10 Returns the set of points where a line segment from one feature intersects a line segment from the other feature, and both features have a node at the point of intersection.

miIntersectAll 11 Returns all points where the features cross or intersect, regardless of whether there are common nodes at the point of intersection. In other words, retrieves all of the miIntersectCommon points and all miIntersectCrossings points.

100 MapX Reference

Page 115: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.IntersectionTest method (FeatureFactory object)

Syntax

OBJECT IntersectionTest ( feature1, feature2, [flag] )

Remarks

This method tests two features to determine whether they intersect. There are three types of intersection test; the flag argument controls which type of test is performed.

Part Description

OBJECT A FeatureFactory object.

feature1 A Feature object.

feature2 A Feature object.

flag Variant: An IntersectionTestConstants value; see below. Optional; if omitted, the default is miIntersectFeature.

Setting Value Description

miIntersectCentroidWithinFeature 0 Test returns True if the centroid of feature1 falls within feature2.

miIntersectFeature 1 Test returns True if the two features intersect at any point, or if adjacent features share common nodes.

miIntersectEntirelyWithinFeature 2 Test returns True if feature1 is entirely inside of feature2.

Mapx Referenc 101

Page 116: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FeatureFactory.IntersectionTest method (FeatureFactory object)

102 MapX Reference

Page 117: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Field object and Fields collection

Each DataSet has a collection of fields (DataSet.fields property). The Fields collection represents the fields for that DataSet.Fields collections are also used as a parameter for DataSets.Add and also for Themes.Add.

Object Properties• Field.AggregationFunction property • Field.Name property• Field.Type property

Collection Properties• Fields.Count property• Fields.Item property

Collection Methods• Fields.Add method• Fields.Remove method• Fields.RemoveAll method

See Also

Dataset object

DataSets.Add method

Themes.Add method

Field.AggregationFunction property (Field object)

Purpose

This property dictates how MapX computes the Field value when multiple data are bound to the same feature. This is a Read-only property, and is set to one of the AggregationFunctionConstants. It is initialized in the Fields.Add method.

See Also

Fields.Add method

Page 118: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Field.Name property (Field object)

Field.Name property (Field object)

Purpose

The field name. This is a String value. This is a Read-only property. This is a default property for Field object.

Field.Type property (Field object)

Purpose

The field type. This take a FieldTypeConstants value. This is a Read-only property.

Fields.Add method (Fields collection)

Purpose

Adds a field to a Fields collection.

Syntax

[ Field= ]OBJECT.Add (DataSourceCol, [Name], [AggregateFunction], [Type])

Remarks

A Fields collection is built to use with the DataSets.Add method. The Fields parameter takes a Fields collection, and is built using this Add method.

The Type parameter is used only with Unbound Datasets. It is ignored for all other DataSet types.

The aggregate function defaults to miAggregationIndividual for string columns, and miAggregationSum for numeric columns.

The Add method can not be used on a dataset's fields collection once the dataset has been created.

Parts Description

OBJECT Represents a Fields object.

DataSourceCol The column from the data source to use. Can be either the name or the index of the column.

Name Name of field to add. The default is the field name in the data source.

AggregateFunction The aggregate function to use. Value: AggregationFunctionConstants

Type The type of data in column. This takes a FieldTypeConstants value.

104 MapX Reference

Page 119: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Fields.Add method (Fields collection)

See Also

DataSets.Add method

DataSets.Fields property

Example in Visual Basic

This sample demonstrates the use of Datasets.Add and the RequestData

`event supported by MapX to build an unbound dataset, which

`allows MapX

`to access data whose format is known only to the programmer.

`In this

`example, the data is in the form of a two-dimensional array

`in VB.

Private Const kNumberOfRows = 3

Dim theData(1 To 3, 1 To 2) As Variant

Private Sub Form_Load()

theData(1, 1) = "ME" `Fill in the data to

theData(2, 1) = "NH" `be used by RequestData

theData(3, 1) = "VT"

theData(1, 2) = 100

theData(2, 2) = 200

theData(3, 2) = 300

Map1.ZoomTo 800, -70.26, 44.05 `Zoom in on New England

End Sub

Private Sub Command1_Click()

Dim flds As New MapXLib.Fields

Dim ds As Dataset

`Describe the structure of the unbound dataset:

flds.Add "State", "State", miAggregationIndividual, _

miTypeString

flds.Add "Sales", "Sales", miAggregationSum, miTypeNumeric

`Create the unbound dataset. The "RequestData" event will be

`triggered to get the data to be used.

Set ds = Map1.Datasets.Add(miDataSetUnbound, Nothing, _

"My Dataset", "State", , "USA", flds)

`Create a theme based on the "Sales" column in the unbound dataset

ds.Themes.Add miThemeGradSymbol, "Sales", "My Theme"

Mapx Referenc 105

Page 120: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Fields.Count property (Fields collection)

End Sub

Private Sub Map1_RequestData(ByVal DataSetName As String, _

ByVal Row As Long, ByVal Field As Integer, _

Value As Variant, Done As Boolean)

Done = False

If DataSetName <> "My Dataset" Or Row > kNumberOfRows Then

Done = True

Else

Value = theData(Row, Field)

End If

End Sub

Fields.Count property (Fields collection)

Purpose

The number of fields in a Fields collection. This is a read-only property

Fields.Item property (Fields collection)

Purpose

Retrieve a Fields object from the Fields collection. This takes a parameter to specify which field. The parameter can specify the field name or index number (1 based index). This is a default property for the Fields collection.

Example in Visual Basic

Dim fld As Field

Set fld = Map1.Datasets("My Dataset").Fields(1)

Example in Delphi

Var fld: variant;

Begin

fld:= Map1.Datasets.Item("MyDataset").Fields.Item(1);

End;

Example in C++

void CSampleProjectView::Item() {

try {

CMapXField fld = m_Map.GetDatasets().Item("My Dataset").GetFields().Item(1);

106 MapX Reference

Page 121: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Fields.Remove method (Fields collection)

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Fields.Remove method (Fields collection)

Purpose

Removes a specified Field object from the Fields collection.

Note: If you remove an item, the collection indexes are renumbered to fill in the hole left by the item removed.

Syntax

OBJECT.Remove (index)

Example in Visual Basic

`This sample demonstrates the use of the Add and Remove

`methods on the Fields collection. For a more practical

`example of how to use the Add method, look at the samples

`for the Datasets.Add method.

Private Sub Command1_Click()

`Create a new, empty Fields collection. Note the

`declaration as "MapXLib.Fields". This is to

`prevent conflicts with the DAO "Fields" object.

Dim flds As New MapXLib.Fields

`Add several fields to the collection

Part Description

OBJECT Represents a Fields object.

index Field object name or 1 based index number.

Mapx Referenc 107

Page 122: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Fields.Remove method (Fields collection)

flds.Add "State", "State", miAggregationIndividual

flds.Add "Sales", "Sum_of_sales", miAggregationSum

flds.Add "Household", "Avg_Household", miAggregationAverage

`Now, remove the third field from the collection:

flds.Remove 3

End Sub

Example in C++

void CSampleProjectView::AddRemove() {

CMapXFields flds;

// Creates a new, empty fields collection

if(!flds.CreateDispatch(flds.GetClsid())) {

TRACE0("Failed to Create Fields collection");

return;

}

try {

// Add several fields to the collection

flds.Add("State","State",miAggregationIndividual);

flds.Add("Sales","Sum_of_sales",miAggregationSum);

flds.Add("Household","Avg_Houshold",miAggregationAverage);

// Now, remove the third fild from the collection

flds.Remove(3);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

108 MapX Reference

Page 123: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Fields.RemoveAll method (Fields collection)

Fields.RemoveAll method (Fields collection)

Purpose

Removes all Field objects from the collection.

Syntax

OBJECT.RemoveAll

Example in Visual Basic

Private Sub btnFieldsRemoveAll_Click()

Dim nFields As Integer

Dim flds As New MapXLib.Fields

nFields = flds.Count

' add two new fields to the fields collection

flds.Add "State", "State", miAggregationIndividual, _

miTypeString

flds.Add "Sales", "Sales", miAggregationSum, miTypeNumeric

nFields = flds.Count

' remove all of the fields

flds.RemoveAll

nFields = flds.Count

End Sub

Example in C++

void CSampleProjectView::RemoveAllFields() {

CMapXFields flds;

if(!flds.CreateDispatch(flds.GetClsid())) {

TRACE0("Failed to Create Fields collection");

return;

}

try {

// Add two new fields to the fields collection

flds.Add(COleVariant("State"),COleVariant("State"),COleVariant((long)miAggregationIndividual),COleVariant((long)miTypeString));

flds.Add(COleVariant("State"),COleVariant("State"),COleVariant((long)miAggregationSum),COleVariant((long)miTypeNumeric));

flds.RemoveAll(); // Remove all of the fields

} catch (COleDispatchException *e) {

Mapx Referenc 109

Page 124: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Fields.RemoveAll method (Fields collection)

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

110 MapX Reference

Page 125: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Find object

Purpose

The Find object allows you to enter the name of a feature and MapX finds it. Refine using a second polygon table, use street maps, and interpolate positions on the street and side of the street using an algorithm.

Object Properties• Find.Abbreviations property (Find object)• Find.CloseMatchMax property (Find object)• Find.ClosestAddress property (Find object)• Find.FindDataset property (Find object)• Find.FindField property (Find object)• Find.OtherBoundary property (Find object)• Find.RefineDataset property (Find object)• Find.RefineField property (Find object)• Find.RefineLayer property (Find object)

Object Methods• Find.SearchEx method (Find object)• Find.Search method (Find object)

Example in Visual Basic of Simple Find

Dim FoundObj As FindFeature

Set Map1.Layers("US Major Cities").Find.RefineLayer = _

Map1.Layers("USA")

Set FoundObj = Map1.Layers("US Major _

Cities").Find.Search("Columbia", "SC")

If (FoundObj.FindRC Mod 10 = 1) Then

Map1.Zoom = 100

Map1.CenterX = FoundObj.CenterX

Map1.CenterY = FoundObj.CenterY

Else

MsgBox "No exact match found. " + Str$(FoundObj.FindRC)

End If

Page 126: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Find object

Example in C++ of Simple Find

void CSampleProjectView::SimpleFind() {

try {

CMapXFindFeature FoundObject = m_Map.GetLayers().Item("US Major Cities").GetFind().Search("Columbia","SC");

if(FoundObject.GetFindRC() %10 == 1) {

m_Map.SetZoom(100);

m_Map.SetCenterX(FoundObject.GetCenterX());

m_Map.SetCenterY(FoundObject.GetCenterY());

} else

AfxMessageBox("No exact match found.");

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example of Find Using Find Field and Adding a MI Table to the Datasets Collection in Visual Basic

Dim FoundObj As FindFeature

Dim Layer As Layer

Dim ds As Dataset

Dim Finds As Dataset

Map1.Layers.Add "C:\program files\mapinfo _

professional\data\usa\states.tab"

Set Layer = Map1.Layers("states")

Set Findds = Map1.Datasets.Add(miDataSetMITable, Layer)

Set Map1.Layers("states").Find.FindDataset = Findds

Set Map1.Layers("states").Find.FindField = Findds.Fields(2)

Set FoundObj = Map1.Layers("states").Find.Search("New York", _

Text2)

112 MapX Reference

Page 127: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Find object

If (FoundObj.FindRC Mod 10 = 1) Then

Map1.Zoom = 500

Map1.CenterX = FoundObj.CenterX

Map1.CenterY = FoundObj.CenterY

Else

MsgBox "No exact match found. " + Str$(FoundObj.FindRC)

End If

Example of Find Using Find Field and Adding a MI Table to the Datasets Collection in C++

void CSampleProjectView::ComplexFind(CString SearchString) {

CMapXFindFeature FoundObj;

CMapXLayer Layer;

COleVariant LayerVariant;

CMapXDataset ds, Findds;

try {

m_Map.GetLayers().Add("C:\\Program Files\\MapInfo MapX\\Maps\\states.tab");

Layer= m_Map.GetLayers().Item("states");

LayerVariant.vt = VT_DISPATCH

LayerVariant.pdispVal = Layer.m_lpDispatch;

Findds = m_Map.GetDatasets().Add(miDataSetLayer,LayerVariant);

m_Map.GetLayers().Item("states").GetFind().SetFindDataset(Findds);

m_Map.GetLayers().Item("states").GetFind().SetFindField(Findds.GetFields().Item(2));

FoundObj = m_Map.GetLayers().Item("states").GetFind(). Search(SearchString,"New York");

if(FoundObj.GetFindRC() % 10 == 1) {

m_Map.SetZoom(500);

m_Map.SetCenterX(FoundObj.GetCenterX());

m_Map.SetCenterY(FoundObj.GetCenterY());

} else

AfxMessageBox("No exact match found.");

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

Mapx Referenc 113

Page 128: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Find object

e->Delete();

}

}

// Geoset object and collection (Page 72)

void CSampleProjectView::Geoset() {

try {

CMapXGeoset gs = m_Map.GetGeosets().Item("United States");

m_Map.SetCenterX(gs.GetCentroid().GetX());

m_Map.SetCenterY(gs.GetCentroid().GetY());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

// LabelProperties Object (Page 77)

void CSampleProjectView::EditLabelProperties(CDaoRecordset& SourceRecordset) {

COleVariant variant;

CMapXDataset ds;

variant.vt = VT_DISPATCH;

variant.pdispVal = SourceRecordset.m_pDAORecordset;

try {

ds = m_Map.GetDatasets().Add(miDataSetDAO,variant);

m_Map.GetLayers().Item("usa").GetLabelProperties(). SetDataset(ds);

m_Map.GetLayers().Item("usa").GetLabelProperties().SetDataField(ds.GetFields().Item("GEONAME"));

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {e->ReportError();e->Delete();

}

}

114 MapX Reference

Page 129: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Find.Abbreviations property (Find object)

Find.Abbreviations property (Find object)

Purpose

This will let the user type in ST, STR, or STREET, and MapX will match all to ST. Default is TRUE.

Find.CloseMatchMax property (Find object)

Purpose

This returns the maximum number of close matches loaded in FindResult from SearchEx. Default value is 8.

Find.ClosestAddress property (Find object)

Purpose

Boolean - match to closest house number if specified number not found.

For example, .if the user asked for 120 ELM ST, but MapX only knows about 1-100 ELM ST, this would cause MapX to match to 100 ELM ST. Default is FALSE.

Find.FindDataset property (Find object)

Purpose

Dataset of field to match against. If not specified, layer's primary key used.

Find.FindField property (Find object)

Purpose

Field from Dataset to match against. Used in conjunction with FindDataset property

See Also

FindDataset property

Mapx Referenc 115

Page 130: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Find.SearchEx method (Find object)

Find.SearchEx method (Find object)

Purpose

The SearchEx method extends the functionality of the search method. It enables the search engine to look for the closest matches returned in a collection. A developer might present this to a user in a list box. Initially a search will try to return an exact match with the parameters given to the method. If an exact match is not found, then the MatchedFeature will contain nothing and the FindMatches collection will contain all close FindMatch items found.

Syntax

[ FindResult= ]OBJECTSearchEx (Address, [Boundary] )

Example

Public Sub SearchEx(txtCity As String, txtState As String)

Dim lyrCity As Layer

Dim dsCity As Dataset

Dim dsState As Dataset

Dim objFindResult As FindResult

Dim intNumCols As Integer

Dim intNumRows As Integer

Dim counter As Integer

Dim firstcounter As Integer

' This file ships as sample data with MapX.

Set lyrCity = Map1.Layers("US Minor Cities")

Set lyrState = Map1.Layers("USA")

' Add the datasets

Set dsCity = Map1.Datasets.Add(miDataSetLayer, lyrCity)

Set dsState = Map1.Datasets.Add(miDataSetLayer, lyrState)

' Set the city dataset to be the find dataset

Set lyrCity.Find.FindDataset = dsCity

Parts Description

OBJECT Represents a Find object.

Address A string, which is the name of the object or street address that you want to find. For example, “Rensselaer, 6 Georgian Ct,”, “London”, or “3 Elm Street”.

Boundary A string, which is the name of the refining boundary object. Used when a refining layer is specified. For example, “NY”, “12211”. If a refine layer has been set, this argument is required; otherwise it is optional.

116 MapX Reference

Page 131: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Find.SearchEx method (Find object)

Set lyrCity.Find.FindField = dsCity.Fields("city")

' Set the state dataset to be the refining dataset

Set lyrCity.Find.RefineLayer = lyrState

Set lyrCity.Find.RefineDataset = dsState

Set lyrCity.Find.RefineField = dsState.Fields("state")

Set objFindResult = lyrCity.Find.SearchEx(txtCity, txtState)

If objFindResult.MultipleMatches = True Then

For Each objMatchCandidate In objFindResult.Matches

firstcounter = firstcounter + 1

List1.AddItem objMatchCandidate.Name

intNumRows = objFindResult.Matches.Count

intNumCols = dsCity.Fields.Count

CityGrid.Cols = intNumCols

CityGrid.Rows = intNumRows

For counter = 1 To intNumCols

CityGrid.Row = firstcounter - 1

CityGrid.Col = counter - 1

CityGrid.Text = dsCity.Value(objMatchCandidate.FeatureID,counter)

Next

Next

Else

List1.AddItem objFindResult.MatchedFeature.Name

intNumCols = dsCity.Fields.Count

CityGrid.Cols = intNumCols

For counter = 1 To intNumCols

CityGrid.Col = counter - 1

CityGrid.Text = dsCity.Value(objFindResult.MatchedFeature.FeatureID, counter)

Next

End If

End Sub

Mapx Referenc 117

Page 132: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Find.OtherBoundary property (Find object)

See Also

FindResult

FindMatches

FindMatch

Find.OtherBoundary property (Find object)

Purpose

This Boolean property applies when a refining boundary is used and controls how MapX deals with a lack of matches within the refine boundary

When False, Find.Search will only return a match if it is within the refining boundary and return no match otherwise. When True, Find.Search will first return a match within the refining boundary; if there are none, it will return a match outside the refining boundary. The default is False.

See Also

Find.RefineLayer property

Find.Search method

Find.RefineDataset property (Find object)

Purpose

When specifying a RefineLayer, you can use the geocolumn to match, or you can override by specifying a Dataset and Field to use instead.

Find.RefineField property (Find object)

Purpose

Used in conjunction with RefineDataset.

Find.RefineLayer property (Find object)

Purpose

Layer to refine with. Refinement is useful when there may be multiple matches.

For example, there may be multiple BROADWAYs in a street map - one per zip code. So you can use the Zipcode layer to refine. Then when finding, you specify the street AND zip code.

118 MapX Reference

Page 133: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Find.Search method (Find object)

See Also

Find.RefineField property

Find.RefineDataset property

Find.Search metho (Find object)

Purpose

Searches the layer for a street address or for the name of a feature on the map; returns a FindFeature object.

Syntax

OBJECT Search (Address [ Boundary ] )

For examples, see the Find object discussion.

See Also

FindFeature object

Part Description

OBJECT A Find object.

Address A string, which is the name of the object or street address that you want to find. For example, “Rensselaer, 6 Georgian Ct,”, “London”, or “3 Elm Street”.

Boundary A string, which is the name of the refining boundary object. Used when a refining layer is specified. For example, “NY”, “21135”. If a refine layer has been set, this argument is required; otherwise it is optional.

Mapx Referenc 119

Page 134: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Find.Search method (Find object)

120 MapX Reference

Page 135: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FindFeature object

The FindFeature object is a super class of the Feature with the addition of a result code (FindRC).

FindFeature is returned by the search method of the Find object and contains all the properties of a Feature object and the FindRC property.

Object Properties• FindFeature.FindRC property

See Also

Feature object

FindFeature.FindRC property (FindFeature object)

Purpose

FindRC is the result code of the find operation.

To obtain the X,Y and/or object ID use the properties, CenterX, CenterY, FeatureID (see, Feature objects. If an address was found FeatureID will be 0.

Digit Values Meaning

xx1 Exact match

xx2 A substitution from the abbreviations file used

xx3 ( – ) Exact match not found

xx4 ( – ) No object name specified; match not found

x1x Side of street undetermined

x2x ( + / – ) Address number was within min/max range

x3x ( + / – ) Address number was not within min/max range

x4x ( + / – ) Address number was not specified

x5x ( – ) Streets do not intersect

x6x ( – ) The row matched does not have a map object 1xx ( + / – )

Name found in only one region other than specified

region

Page 136: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FindFeature.FindRC property (FindFeature object)

2xx ( – ) Name found in more than one region other than the spec-

ified region

3xx ( + / – ) No refining region was specified, and one match was

found

4xx ( – ) No region was specified, and multiple matches wer

found

5xx ( + ) Name found more than once in the specified region

122 MapX Reference

Page 137: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FindMatch object and FindMatches collection

The FindMatch object returns a match item returned from the SearchEx method defining close matches or exact matches. The FindMatches collection is rated in order of score with best score first.

Object Properties• FindMatch.Name property (FindMatch object)• FindMatch.FeatureID property (FindMatch object)• FindMatch.Score property (FindMatch object)

Collection Properties• FindMatches.Count property (FindMatches collection)• FindMatches.Item property (FindMatches collection)

See Also

FindResult object

SearchEx method

FindMatch.Name property (FindMatch object)

Purpose

Returns the name of the object or street.

FindMatch.FeatureID property (FindMatch object)

Purpose

Returns the ID of the feature if it exists. If feature does not exist, a zero is returned.

FindMatch.Score property (FindMatch object)

Purpose

Returns the matching score for close matches or zero for no match -- 100 (exact match).

Page 138: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FindMatches.Count property (FindMatches collection)

FindMatches.Count property (FindMatches collection)

Purpose

This read-only property indicates the number of matches in the collection.

FindMatches.Item property (FindMatches collection)

Purpose

This returns an item in the FindMatches collection. The items are ordered by there score in the FindMatches collection (the best score first).

Syntax

[FindMatch=]OBJECT Item (index)

Parts Description

OBJECT Represents a FindMatches collection

index The integer index of the item returned.

124 MapX Reference

Page 139: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FindResult object

The FindResult object returns information about the FindRC in the form of properties that make it easier to access the result of the find. FindResult contains a collection of features that contain either the multiply matched features, or the closest matched features in priority order of how they scored in the find. If an exact match is found, then the feature collection will only contain the ExactMatch feature.

Object properties• FindResult.AddressRangeOutOfRange property (FindResult object)• FindResult.ExactMatch property (FindResult object)• FindResult.FindRC property (FindResult object)• FindResult.IntersectionNotFound property (FindResult object)• FindResult.MatchedFeature property (FindResult object)• FindResult.Matches property (FindResult object)• FindResult.MultipleMatches property (FindResult object)• FindResult.RefineRegion property (FindResult object)• FindResult.Substitute property (FindResult object)

See Also

SearchEx method

FindResult.AddressOutOfRange property (FindResult object)

Purpose

Returns a boolean value if address number is in range.

FindResult.ExactMatch property (FindResult object)

Purpose

Returns a boolean value if exact match is returned.

FindResult.FindRC property (FindResult object)

Purpose

Searches the layer for a street address or for the name of a feature on the map; returns a FindFeature object.

Page 140: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FindResult.IntersectionNotFound property (FindResult object)

FindResult.IntersectionNotFound property (FindResult object)

Purpose

This read-only property returns a boolean value indicating whether streets intersect.

FindResult.MatchedFeature property (FindResult object)

Purpose

Resulting ExactMatch feature.

FindResult.Matches property (FindResult object)

Purpose

Resulting Match collection.

FindResult.MultipleMatches property (FindResult object)

Purpose

Returs a boolean value if multiple matches are found.

FindResult.RefineRegion property (FindResult object)

Purpose

Returns a boolean value if refining region is specified.

FindResult.Substitute property (FindResult object)

Purpose

Returns a boolean value if substitute was used from abbreviation file.

126 MapX Reference

Page 141: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Geoset object and Geosets collection

The Geoset object is built off the Map object and allows you to define a geoset. A Geoset is a collection of map layers and their settings. The Geosets collection object is a collection of Geoset objects.

Object Properties• Geoset.Centroid property • Geoset.PathName property • Geoset.UserName property

Collection Properties• Geosets.Count property • Geosets.Item property

Example

Dim gs As Geoset

gs = Map1.Geosets("United States")

Map1.CenterX = gs.Centroid.X

Map1.CenterY = gs.Centroid.Y

See Also

Map object

Geoset.Centroid property (Geoset object)

Purpose

Point object defining the geographic center of the geoset

See Also

Point object

Geoset.PathName property (Geoset object)

Purpose

Path defining the physical location of the geoset.

Page 142: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Geoset.UserName property (Geoset object)

Geoset.UserName property (Geoset object)

Purpose

Name defining the geoset.

Geosets.Count property (Geosets collection)

Purpose

The number of Geoset objects in the collection. This is a read-only property

Geosets.Item property (Geosets collection)

Purpose

Retrieve a particular Geoset object from a collection. This is a Variant, and you can specify the Geoset's user name or a 1 based index number. This is a default property for the Geosets collection.

128 MapX Reference

Page 143: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Graphic object

Purpose

Each Annotation contains a Graphic object (Annotation.Graphic property) in which the symbol or text style and location is stored.

Object Properties• Graphic.Caption property • Graphic.Position property • Graphic.Style property • Graphic.X property • Graphic.Y property

See Also

Annotation object

Graphic.Caption property (Graphic object)

Purpose

Contains the text string if the annotation is of type miTextAnnotation. This is a String value.

See Also

Annotation.Type property

AnnotationTypeConstants

Graphic.Position property (Graphic object)

Purpose

Contains a value indicating how the text should be drawn with respect to the X,Y coordinates. This is only used if annotation type is miTextAnnotation. This takes a PositionConstants value, and defaults to miPositionTL.

See Also

Annotation.Type property

PositionConstants

Page 144: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Graphic.Style property (Graphic object)

Graphic.Style property (Graphic object)

Purpose

A Style object containing the style of the symbol or text. This is a read-write property

See Also

Style object

Graphic.X property (Graphic object)

Purpose

Contains the X coordinate of the annotation. This is a Double value, and represents the earth coordinate (longitude). If the annotation type is miTextAnnotation, the position of the annotation is controlled by the X,Y coordinates in conjunction with the Position property. If the annotation type is miSymbolAnnotation, the X,Y coordinates refer to the center of the symbol.

See Also

Annotation.Type property

AnnotationTypeConstants

Graphic.Position property

Graphic.Y property (Graphic object)

Purpose

Contains the Y coordinate of the annotation. This is a Double value, and represents the earth coordinate (latitude). If the annotation type is miTextAnnotation, the position of the annotation is controlled by the X,Y coordinates in conjunction with the Position property. If the annotation type is miSymbolAnnotation, the X,Y coordinates refer to the center of the symbol.

See Also

Annotation.Type property

AnnotationTypeConstants

Graphic.Position property

130 MapX Reference

Page 145: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

IndividualValueCategory object and IndividualValueCategories collection

IndividualValueCategory object and IndividualValueCategories collection

An individual-values thematic map's settings are exposed through the IndividualValueCategories collection, which is a collection of IndividualValueCategory objects one object for each unique value in the theme.

To obtain an IndividualValueCategories collection, reference the ThemeProperties.IndividualValueCategories property

Object Properties• IndividualValueCategory.NumItems property • IndividualValueCategory.Style property • IndividualValueCategory.Value property

Collection Properties• IndividualValueCategories.AllOthersCategory property • IndividualValueCategories.Count property • IndividualValueCategories.Item property

See Also

Legend object

ThemeProperties.IndividualValueCategories property

IndividualValueCategories.AllOthersCategory property (Individual-ValueCategories collection)

Returns one IndividualValueCategory object from the collection; this object describes a category for all value ranges not in the individual values theme. The IndividualValueCategory object returned with the AllOthersCategory property has a Value property that is not defined and its default value is an empty string (“”). However, you can set its Style property as shown in the example below. The text that appears in the legend for the AllOthersCategory range category object can be set with the LegendTexts.AllOthersText property.

Example

Dim ds As Dataset

Dim lyr as Layer

Dim thm As MapXLib.Theme

Dim styl As MapXLib.Style

Dim AllOthers As MapXLib.IndividualValueCategory

Mapx Referenc 131

Page 146: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

IndividualValueCategories.Count property (IndividualValueCategories collection)

Set lyr = Map1.Layers.Add("states.tab", 1)

Set ds = Map1.Datasets.Add(miDataSetLayer, Map1. _

Layers("STATES"))

ds.Themes.Add miThemeIndividualValue, "STATE",

"My Theme", False

Set thm = ds.Themes("My Theme")

thm.Visible = Tru

Set styl = Map1.DefaultStyle

styl.PickRegion

Set AllOthers = _

thm.ThemeProperties.IndividualValueCategories. _

AllOthersCategory

AllOthers.Style = styl

IndividualValueCategories.Count property (IndividualValueCategories collection)

Purpose

Read-only integer value, indicating the number of unique individual values in the theme.

IndividualValueCategories.Item property (IndividualValueCategories collection)

Purpose

Returns one IndividualValueCategory object from the collection; this object describes one of the unique values in the individual values theme.

132 MapX Reference

Page 147: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

IndividualValueCategory.NumItems property (IndividualValueCategories collection)

IndividualValueCategory.NumItems property (IndividualValueCate-gories collection)

Purpose

NumItems is the number of features that fall into this category. This is an Integer value and is a read-only property

Note: This property is only valid when MapX generates the theme (Theme.ComputeTheme = TRUE). If you are manually calculating the theme (Theme.ComputeTheme = FALSE), then NumItems will NOT reflect the number of items in the category and is undefined as a result.

IndividualValueCategory.Style property (IndividualValueCategories collection)

Purpose

This controls the style for the category. This is a Style object and may be set to an existing style object or you may set the style properties individually. The defaults are designed to provide highly contrasting styles.

See Also

Style object

IndividualValueCategory.Value property (IndividualValueCategory object)

Purpose

This property gets or sets the value of an individual value category in an individual value theme. The property can only be set when the Theme.ComputeTheme property is set to FALSE.

Note that setting the Value property does not affect the Legend.LegendTexts collection for the theme. That has to be updated separately.

Syntax

IndividualValueCategory.Value property

Mapx Referenc 133

Page 148: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

IndividualValueCategory.Value property (IndividualValueCategory object)

134 MapX Reference

Page 149: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LabelProperties object

The LabelProperties object contains properties that control how labels are drawn for the layer.

Object Properties• LabelProperties.DataField property (LabelProperties object)• LabelProperties.DataSet property (LabelProperties object)• LabelProperties.Duplicate property (LabelProperties object)• LabelProperties.LabelMax property (LabelProperties object)• LabelProperties.LabelZoom property (LabelProperties object)• LabelProperties.LabelZoomMax property (LabelProperties object)• LabelProperties.LabelZoomMin property (LabelProperties object)• LabelProperties.LineType property (LabelProperties object)• LabelProperties.Offset property (LabelProperties object)• LabelProperties.Overlap property (LabelProperties object)• LabelProperties.Parallel property (LabelProperties object)• LabelProperties.PartialSegments property (LabelProperties object)• LabelProperties.Position property (LabelProperties object)• LabelProperties.Style property (LabelProperties object)• LabelProperties.Visible property (LabelProperties object)

Example

Dim DS As Object

Dim DB As Object

Dim RS As Object

Dim Temp As Object

Set DB = Workspaces(0).OpenDatabase("C:\Program _

Files\MapInfo MapV2\Data\Mapstats.mdb")

Set RS = DB.OpenRecordset("USA")

Set DS = Map1.Datasets.Add(miDataSetDAO, RS)

Set Map1.Layers("usa").LabelProperties.Dataset = DS

Set Temp = DS.Fields("GEONAME")

Set Map1.Layers("usa").LabelProperties.DataField = Temp

See Also

Layer object

Page 150: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LabelProperties.DataField property (LabelProperties object)

LabelProperties.DataField property (LabelProperties object)

Purpose

Sets the location (i.e. the DataField) used for labels. The field used for labeling is specified by both this property as well as the DataSet property to indicate which DataSet to use. This takes a Field object.

Example in C++

// LabelProperties.Dataset Property

// LabelProperties.DataField Property

// Layer.AutoLabel Property

// LabelProperties.Position Property

// LabelProperties.Offset Method

void CSampleProjectView::LabelStates() {

// Label the states with their complete name

CMapXLayer USALayer = m_Map.GetLayers().Item("USA");

CMapXDataset USData;

COleVariant lyrVt;

// Make a variant for the parameter to datasets.Add

lyrVt.vt = VT_DISPATCH;

lyrVt.pdispVal = USALayer;

lyrVt.pdispVal->AddRef();

try {

// Add the layer as a dataset to bring in the State_Name field

USData = m_Map.GetDatasets().Add(miDataSetLayer,lyrVt);

USALayer.SetAutoLabel(TRUE);

// Label with the "State_Name" field of the dataset we just added

USALayer.GetLabelProperties().SetDataset(USData);

USALayer.GetLabelProperties().SetDataField(USData.GetFields().Item("State_Name"));

// Position the label 4 points to the bottom right of the center of the State

USALayer.GetLabelProperties().SetPosition(miPositionBR);

USALayer.GetLabelProperties().SetOffset(4);

136 MapX Reference

Page 151: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LabelProperties.DataField property (LabelProperties object)

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub LabelStates()

' Label the states with their complete name

Dim USALayer As Layer

Dim USData As Dataset

Set USALayer = Map1.Layers.Item("USA")

' Add the layer as a dataset to bring in the State_Name field

Set USData = Map1.Datasets.Add(miDataSetLayer,USALayer)

' Label with the "State_Name" field of the dataset we

` just added

Set USALayer.LabelProperties.Dataset = USData

Set USALayer.LabelProperties.DataField = _

USData.Fields.Item("State_Name")

' Position the labels 4 points to the bottom right of the

` center of the State

USALayer.LabelProperties.Position = miPositionBR

USALayer.LabelProperties.Offset = 4

USALayer.AutoLabel = True

End Sub

See Also

LabelProperties.DataSet property

Field object

Mapx Referenc 137

Page 152: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LabelProperties.DataSet property (LabelProperties object)

LabelProperties.DataSet property (LabelProperties object)

Purpose

Sets the Dataset to use for labels. The field to use for labeling is specified by both this property as well as the DataField property to indicate which field in the DataSet to use. Specifying no DataSet causes the features to get labeled with the feature name. This is the default behavior. This takes a DataSet object.

See Also

LabelProperties.DataField property

DataSet object

LabelProperties.Duplicate property (LabelProperties object)

Purpose

Controls whether features with the same name can have labels on the map simultaneously. This is a Boolean value, and the default is False.

LabelProperties.LabelMax property (LabelProperties object)

Purpose

Controls the maximum number of labels that are automatically generated for a layer. This is an Integer value, and the default is 100.

LabelProperties.LabelZoom property (LabelProperties object)

Purpose

Controls whether labels are zoom layered. Zoom layering controls the range of zoom levels (distance across map) the labels are displayed. If LabelZooming is on, then the values stored in the LabelZoomMax and LabelZoomMin properties are used. This is a Boolean value, and the default is False.

See Also

LabelProperties.LabelZoomMax property

LabelProperties.LabelZoomMin property

138 MapX Reference

Page 153: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LabelProperties.LabelZoomMax property (LabelProperties object)

LabelProperties.LabelZoomMax property (LabelProperties object)

Purpose

If label ZoomLayering is on (LabelProperties.LabelZoom property), then this specifies the maximum zoom value for displaying the labels. This takes a Double value specifying distance in Map units (Map.MapUnit). The labels will appear if the zoom is >= to min and < max.

See Also

LabelProperties.LabelZoom property

Map.MapUnit property

LabelProperties.LabelZoomMin property (LabelProperties object)

Purpose

If label ZoomLayering is on (LabelProperties.LabelZoom property), then this specifies the minimum zoom value for displaying the labels. This takes a Double value specifying distance in Map units (Map.MapUnit). The labels will appear if the zoom is >= to min and < max.

See Also

LabelProperties.LabelZoom property

Map.MapUnit property

LabelProperties.LineType property (LabelProperties object)

Purpose

Controls the type of line to be used to connect the label to the feature being labeled. This is used when the Offset is large. This takes a LineTypeConstants value, and the default is miLineTypeNone.

See Also

LineTypeConstants

LabelProperties.Offset property

Mapx Referenc 139

Page 154: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LabelProperties.Offset property (LabelProperties object)

LabelProperties.Offset property (LabelProperties object)

Purpose

Specify the distance between the label and the feature being labeled. This is useful for symbol features, when you want the label a certain distance away from the symbol. This is an Integer value, and specifies the distance in pixels. The default is 5.

LabelProperties.Overlap property (LabelProperties object)

Purpose

Allow labels to overlap each other when they are drawn on a layer. This is a Boolean value, and the default is False.

LabelProperties.Parallel property (LabelProperties object)

Purpose

Controls whether to label linear features with the label parallel to the feature. This is a Boolean value, and the default is True.

LabelProperties.PartialSegments property (LabelProperties object)

Purpose

Setting this value to true enables MapX to label polylines, even if only a small part of the polyline is currently visible. However, this will NOT work for other features/objects, as it only applies to autolabels. This is a Boolean value, and the default is True.

LabelProperties.Position property (LabelProperties object)

Purpose

Sets how the label should be positioned relative to the map feature. This takes a PositionConstants value.

The default value depends on the PredominantObjectType:• miFeatureTypeSymbol is miPositionCL• miFeatureTypeLine is miPositionBC• miFeatureTypeRegion is miPositionCC

140 MapX Reference

Page 155: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LabelProperties.Style property (LabelProperties object)

LabelProperties.Style property (LabelProperties object)

Purpose

Sets the style used to display the labels. The default is 10 point Helvetica.

LabelProperties.Visible property (LabelProperties object)

Purpose

Controls whether labels are visible for the layer. Labels can be created using the Layer.Autolabel property, or manually using the Layer.LabelAtPoint method or using the Label tool. This Visible property controls whether all labels for the layer are visible or not. This takes a Boolean value, and the default is True.

Mapx Referenc 141

Page 156: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LabelProperties.Visible property (LabelProperties object)

142 MapX Reference

Page 157: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer object and Layers collection

Each Map has a collection of layers. The Layers collection is made up of Layer objects. The Layers collection has methods and properties used to add and remove Layer objects from the collection.

Computer maps are organized into layers. Think of the layers as transparencies that are stacked on top of one another. Each layer contains different aspects of the entire map. Each layer contains different map objects, such as regions, points, lines and text.

For example, one layer may contain state boundaries, a second layer may have symbols that represent capitals, a third layer might consist of text labels. By stacking these layers one on top of the other, you begin to build a complete map. You can display one, two, or many layers at a time. Map layers form the building blocks of maps in MapX. Once you have created your map of layers, you can customize the layers in a variety of ways, add and delete layers, or reorder them.

You can set the following layer options by using the commands and properties in the Layers collection and object, and LabelProperties object.

Reordering Layers

Map layers display in a particular order. It is important to order your layers correctly. For example, you have a layer of customer points and a layer of census tracts. If the layers arincorrectly ordered in the map window, MapX might draw the customer points first and then display the census tract layer second. Your points would be obscured beneath the census tract layer.

Zoom Layering

Sometimes you want a map layer to display only at certain zoom levels. Zoom Layering controls the display of a map layer only when the map's zoom level falls within a preset distance.

For example, you have a layer of streets and a layer of ZIP Code boundaries. When you zoom out past 10 or so miles, the streets look like a black smudge in the window. This is because the zoom (window width) is too wide to show detailed street maps. Use Zoom Layering to tell MapX to display the street layer only when the zoom is set to distance that allows you to see the street detail properly, for instance, less than 5 miles.

The first map doesn't have zoom layering set for its street layer. At a zoom of 15 miles across, notice how difficult it is to see any detail. The second map has zoom layering set to display the streets when the zoom is less than five miles. Therefore, the streets layer does not display when the window is set at 15 miles.

You can set a different zoom layering level for each layer.

Page 158: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer object and Layers collection

Object Properties• Layer.AutoLabel property (Layer object)• Layer.Bounds property (Layer object)• Layer.CoordSys property (Layer object)• Layer.DataSets property (Layer object)• Layer.DrawLabelsAfter property (Layer object)• Layer.FileSpec property (Layer object)• Layer.Find property (Layer object)• Layer.KeyField property (Layer object)• Layer.LabelProperties property (Layer object)• Layer.Name property (Layer object)• Layer.NoFeatures method (Layer object)• Layer.OverrideStyle property (Layer object)• Layer.PredominantFeatureType property (Layer object)• Layer.Selectable property (Layer object)• Layer.Selection property (Layer object)• Layer.ShowCentroids property (Layer object)• Layer.ShowLineDirection property (Layer object)• Layer.ShowNodes property (Layer object)• Layer.Style property (Layer object)• Layer.Type property (Layer object)• Layer.Visible property (Layer object)• Layer.ZoomLayer property (Layer object)• Layer.ZoomMax property (Layer object)• Layer.ZoomMin property (Layer object)

Object Methods• Layer.AddFeature method (Layer object)• Layer.AllFeatures method (Layer object)• Layer.BeginAccess method (Layer object)• Layer.ClearCustomLabels method (Layer object)• Layer.Editable property (Layer object)• Layer.EndAccess method (Layer object)• Layer.Search method (Layer object)• Layer.DeleteFeature method (Layer object)• Layer.DrilldownAddFeatures method (Layer object)• Layer.DrilldownRemoveFeatures method (Layer object)• Layer.DrilldownReset method (Layer object)• Layer.FeatureIDFromFeatureName method (Layer object)• Layer.FeatureKeyFromFeatureName method (Layer object)• Layer.GetDrilldownFeaturesByID method (Layer object)• Layer.GetFeatureByID method (Layer object)• Layer.GetFeatureByKey method (Layer object)• Layer.Invalidate method (Layer object)• Layer.LabelAtPoint method (Layer object)• Layer.Refresh method (Layer object)

144 MapX Reference

Page 159: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.AddFeature method (Layer object)

• Layer.SearchAtPoint method (Layer object)• Layer.SearchWithinDistance method (Layer object)• Layer.SearchWithinFeature method (Layer object)• Layer.SearchWithinRectangle method (Layer object)• Layer.UpdateFeature method (Layer object)

Collection Properties• Layers.AnimationLayer property (Layers collection)• Layers.Bounds property (Layers collection)• Layers.Count property (Layers collection)• Layers.InsertionLayer property (Layers object)• Layers.Item property (Layers collection)

Collection Methods• Layers.Add method (Layers collection)• Layers.AddGeosetLayers method (Layers collection)• Layers.AddServerLayer method (Layers collection)• Layers.AddUserDrawLayer method (Layers collection)• Layers.ClearSelection method (Layers collection)• Layers.CreateLayer method (Layers collection)• Layers.LayersDlg method (Layers collection)• Layers.Move method (Layers collection)• Layers. Remove method (Layers collection)• Layers.RemoveAll method (Layers collection)

See Also

Map Object

Layer.AddFeature method (Layer object)

Purpose

Creates and returns a new feature in the layer with the properties of the Source object feature. This method is useful for Object Editing.

Syntax

OBJECT.AddFeature (Source, [RowValues])

Part Description

OBJECT Represents a Layer object.

Source Source is a Feature object.

RowValues Represents a RowValues collection, and contains the values of the data columns.

Mapx Referenc 145

Page 160: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.AddFeature method (Layer object)

See Also

Layer.AllFeatures method

Layer.DeleteFeature method

Layer.Invalidate method

Layer.NoFeatures method

Layer.SearchAtPoint method

Layer.SearchWithinDistance method

Layer.SearchWithinFeature method

Layer.SearchWithinRectangle method

Layer.UpdateFeature method

Feature.FeatureKey property

Example in Visual Basic

Private Sub Map1_ToolUsed(ByVal ToolNum As Integer, ByVal X1 _

As Double, ByVal Y1 As Double, ByVal X2 As Double, ByVal Y2 _

As Double, ByVal Distance As Double, ByVal Shift As Boolean, _

ByVal Ctrl As Boolean, EnableDefault As Boolean)

Dim f As New Feature

If ToolNum = miArrowTool Then

f.Type = miFeatureTypeSymbol

f.Style = Map1.DefaultStyle

f.Point.Set X1, Y1

Map1.Layers("Fred").AddFeature f

End If

End Sub

Example in C++

void CSampleProjectView::OnToolUsed(short ToolNum, double X1, double Y1, double X2, double Y2, double Distance, BOOL Shift, BOOL Ctrl, BOOL FAR* EnableDefault) {

CMapXFeature fea;

if(!fea.CreateDispatch(fea.GetClsid())) {

TRACE0("Failed to Create Feature object");

return;

}

if(ToolNum==miArrowTool) {

try {

146 MapX Reference

Page 161: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.AddFeature method (Layer object)

fea.SetType(miFeatureTypeSymbol);

fea.SetStyle(m_Map.GetDefaultStyle());

fea.GetPoint().Set(X1,Y1);

m_Map.GetLayers().Item("Fred").AddFeature(fea);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

}

//// Layer.SearchAtPoint method (Page 91)

void CSampleProjectView::OnMouseDown(short FAR* Button, short FAR* Shift, float FAR* X, float FAR* Y) {

double longitude,latitude;

CMapXFeatures fs;

CMapXPoint pnt;

// Create the new point

if(!pnt.CreateDispatch(pnt.GetClsid())) {

TRACE0("Failed to Create Point object");

return;

}

try {

if(m_Map.GetCurrentTool() == miArrowTool) {

m_Map.ConvertCoord(X,Y,&longitude,&latitude,miScreenToMap);

pnt.Set(longitude,latitude);

fs = m_Map.GetLayers().Item("US Top 20 Cities").SearchAtPoint(pnt);

if(fs.GetCount() > 0) {

CString msg;

msg.Format("%d: %s",fs.GetCount(),fs.Item(1).GetName());

AfxMessageBox(msg);

} else

AfxMessageBox("Nothing Found");

Mapx Referenc 147

Page 162: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.AllFeatures method (Layer object)

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

// Layers.AnimationLayer property (Page 99)

void CSampleProjectView::AnimationLayer() {

try {

m_Map.GetLayers().SetAnimationLayer(m_Map.GetLayers().Item(3));

long LayerCount = m_Map.GetLayers().GetCount()

for(long i=1;i<=LayerCount;i++) {

if(m_Map.GetLayers().GetAnimationLayer().m_lpDispatch == m_Map.GetLayers().Item(i).m_lpDispatch) {

//...

}

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Layer.AllFeatures method (Layer object)

Purpose

Returns a features object with all features from the layer.

Syntax

[ Features= ]OBJECT AllFeatures ()

148 MapX Reference

Page 163: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.BeginAccess method (Layer object)

See Also

Layer.AddFeature method

Layer.DeleteFeature method

Layer.Invalidate method

Layer.NoFeatures method

Layer.SearchAtPoint method

Layer.SearchWithinDistance method

Layer.SearchWithinFeature method

Layer.SearchWithinRectangle method

Layer.UpdateFeature method

Layer.BeginAccess metho (Layer object)

Purpose

The BeginAccess method will open and lock the table for read or write access. This improves the performance for repeated layer and dataset operations. You must call Layer.EndAccess once for each call to Layer.BeginAccess.

Syntax

OBJECT.BeginAccess (BeginAccessType)

Remarks

MapX programs written without using BeginAccess and EndAccess will work as before, but without the performance enhancement for multiple operations.

You may nest calls to BeginAccess, however, only the first one has any effect.

See Also

Layer.EndAccess

Parts Description

OBJECT Represents a Layer object.

beginAccessType One of the LayerBeginAccessConstants, specifying the type of access (e.g. read-only or read-write).

Mapx Referenc 149

Page 164: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.ClearCustomLabels method (Layer object)

Layer.ClearCustomLabels method (Layer object)

Purpose

Removes any labels placed on the current layer.

Syntax

OBJECT.ClearCustomLabels

Layer.Editable property (Layer object)This property allows a selection in the layer to be edited (moved, resized, or deleted). The ArrowTool can be used to move or resize selected objects. The delete key deletes selected objects.

Layer.EndAccess method (Layer object)

Purpose

The EndAccess method unlocks map tables. You must call Layer.EndAccess once for each call to Layer.BeginAccess.

Syntax

OBJECT EndAccess (endAccessType)

RemarksIf Layer.BeginAccess was called with a beginAccessType of miAccessRead or miAccessReadWrite, the EndAccessType parameter must be miAccessEnd. MapX programs written without using BeginAccess and EndAccess will work as before, but without the performance enhancement for multiple operations.

See Also

BeginAccess method

Parts Description

OBJECT Represents a Layer object.

endAccessType One of the LayerEndAccessConstants, specifying the end access type.

150 MapX Reference

Page 165: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.Search method (Layer object)

Layer.Search method (Layer object)

Purpose

The Layer.Search method exposes the power of SQL queries. The expression (the "where-clause" portion of the statement) is evaluated for each row in the Layers table, and a Features collection is returned, made up of every feature for which the expression is true.

Syntax

[ Features= ]OBJECT.Search (strWhere)

Example in Visual Basic

Dim lyrUSA As MapXLib.Layer

Dim ftrs As MapXLib.Features

Set lyrUSA = Map1.Layers.Add("USA")

Map1.Datasets.Add miDataSetDAO, Data1.Recordset, "TestDataset", "GEOABBR", , lyrUSA, , False

Set ftrs = lyrUSA.Search("TOTPOP > 1000000")

'*** The features collection will contain all of the states that have a total population greater than 1000000.

See Also

MapX Expressions

Layer.AutoLabel property (Layer object)

Purpose

Controls whether a layer is automatically labeled. This is a Boolean value, and the default is False.

Layer.Bounds property (Layer object)

Purpose

Returns a Rectangle object representing the geographic extents (i.e. the minimum bounding rectangle) of all objects in the layer; does not apply to user draw layers.

Parts Description

OBJECT Represents a Layer object.

strWhere String: An expression to evaluate for each feature.

Mapx Referenc 151

Page 166: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.CoordSys property (Layer object)

Example in C++

// Layer.Bounds Property

void CSampleProjectView::ViewEntireLayer(CMapXLayer& ViewLayer) {

// Set the boundaries of the map view to be the boundaries of the given layer

try {

m_Map.SetBounds(ViewLayer.GetBounds());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub ViewEntireLayer(ViewLayer As MapXLib.Layer)

' Set the boundaries of the map view to be the boundaries

' of the given layer

Map1.Bounds = ViewLayer.Bounds

End Sub

Remarks

This property is useful if you want to zoom the map out far enough to show all objects in one layer.

See Also

Layers.Bounds

Layer.CoordSys property (Layer object)

Purpose

Returns a read-only CoordSys object, indicating the coordinate system in which the layer was saved.

152 MapX Reference

Page 167: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.DataSets property (Layer object)

See Also

CoordSys object

Map.DisplayCoordSys

Map.NumericCoordSys

Layer.DataSets property (Layer object)

Purpose

This read-only property is a DataSets collection that is bound to the map layer it is associated with. This collection is a subset of the full DataSets collection (Map.DataSets). The objects within Layer.DataSets are the same as the objects within Map.DataSets.

Remarks

Layers that do not have datasets (such as Raster and UserDraw) will return an empty collection.

Layer.DataSets will not support the Add or Restore methods. An exception is thrown if either are used.

Adding a dataset to Map.DataSets via Datasets.Add also adds that dataset to the DataSets collection of the layer it is bound to. Removing a dataset from a Layer.DataSet collection, also removes it from Map.DataSets, and vice versa.

See Also

DataSets.Add method

Map.DataSets

Layer.DeleteFeature method (Layer object)

Purpose

Deletes the feature and its database row from the layer

Syntax

OBJECT.DeleteFeature (FeatureKey)

Part Description

OBJECT Represents a Layer object.

FeatureKey The Feature object to delete. This parameter can either be a Feature object or a FeatureKey.

Mapx Referenc 153

Page 168: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.DrawLabelsAfter property (Layer object)

See Also

Layer.AddFeature method

Layer.AllFeatures method

Layer.Invalidate method

Layer.NoFeatures method

Layer.SearchAtPoint method

Layer.SearchWithinDistance method

Layer.SearchWithinFeature method

Layer.SearchWithinRectangle method

Layer.UpdateFeature method

Layer.DrawLabelsAfter property (Layer object)

Purpose

Boolean. When set to True, the labels for all layers from the bottom layer (or the last layer with this property set) up to and including the layer itself are drawn after the layer is drawn. This allows for better control over where labels are in the drawing order.

By default, layers have this property set to False, and the labels are drawn after the topmost layer, but before any animation layer.

Layer.DrilldownAddFeatures method (Layer object)

Purpose

Adds features to a Drilldown layer.

Syntax

OBJECT DrilldownAddFeatures (Level, FeatureKeys)

Part Description

OBJECT A Layer object that corresponds to a Drilldown layer.

Level String, indicating which level in the Drilldown layer contains the features that are to be added.

FeatureKeys Variant: A string or an array of strings, identifying the Drilldown IDs of the features that should be added. Note that these are Drilldown IDs (i.e. values from a column in the Drilldown component table), not the MapX Feature's internal FeatureID values.

154 MapX Reference

Page 169: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.DrilldownRemoveFeatures method (Layer object)

Remarks

This method does not actually alter the contents of any tables. The features that you are adding are already in a table; by "adding" them to the layer, you make them visible.

Layer.DrilldownRemoveFeatures method (Layer object)

Purpose

Removes features from a Drilldown layer.

Syntax

OBJECT DrilldownRemoveFeatures (Level, FeatureKeys)

Remarks

Method does not actually alter the contents of any tables. The features that you are removing are not deleted from the table; by "removing" them, you simply make them disappear.

Layer.DrilldownReset method (Layer object)

Purpose

Clears all features from the Drilldown layer, and reinitializes the layer using features from a single level.

Syntax

OBJECT DrilldownReset (Level)

Part Description

OBJECT A Layer object that corresponds to a Drilldown layer.

Level String, indicating which level contains the features to remove.

FeatureKeys Variant: A string or an array of strings, identifying the Drilldown IDs of the features that should be removed. Note that these are the IDs specified in the Drilldown table's first column, not the MapX Feature's internal FeatureID values.

Part Description

OBJECT A Layer object that corresponds to a Drilldown layer.

Level String, indicating which level of detail should appear in the Drilldown layer. If the string is empty, the layer will be cleared (all objects will be removed from the Drilldown layer).

Mapx Referenc 155

Page 170: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.FeatureIDFromFeatureName method (Layer object)

Remarks

This method resets the Drilldown layer so that it only shows features from one specific level. You might use this method if you want to provide a "Reset" button, which restores the Drilldown layer to its original state.

Layer.FeatureIDFromFeatureName method (Layer object)Given a name, returns the ID of the feature with that name (returns the ID of the first feature with the specified name if the name is not unique within the layer). The name is currently defined to be the value in the first column of the Mapinfo table. Throws an exception if there is no feature with the name specified.

Syntax

[int=]OBJECT FeatureIDFromFeatureName (Name)

Layer.FeatureKeyFromFeatureName method (Layer object)

Purpose

This method returns a FeatureKey from the FeatureName in a Layer object..

Syntax

[BSTR=]OBJECT FeatureKeyFromFeatureName (KeyValue)

See Also

Layer.KeyField property

Part Description

OBJECT Represents a Layer object.

Name A string which is the name of the feature whose ID you want to get.

Part Description

OBJECT Represents a Layer object.

KeyValue The name of the feature. The name is the value of the KeyField.

156 MapX Reference

Page 171: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.FileSpec property (Layer object)

Layer.FileSpec property (Layer object)

Purpose

This property contains the full file specification of where the layer is physically stored. This is a String value, and is read-only.

Layer.Find property (Layer object)

Purpose

Defines the Find object for the layer

Layer.GetDrilldownFeaturesByID metho (Layer object)

Purpose

Returns a Feature object, given the feature's ID.

Syntax

OBJECT GetDrilldownFeaturesByID( strLevel, FeatureID)

Layer.GetFeatureByID metho (Layer object)

Purpose

Returns a Feature object, given the feature's ID.

Part Description

OBJECT Represents a Layer object.

strLevel The name of a level in the Drilldown layer.

FeatureID A string or an array of strings, identifying which feature(s) to query

Mapx Referenc 157

Page 172: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.GetFeatureByKey method (Layer object)

Syntax

OBJECT GetFeatureByID( FeatureKey )

Layer.GetFeatureByKey method (Layer object)

Purpose

This method returns a feature object with a given Key in a Layer object.

Syntax

[Feature=]OBJECT GetFeatureByKey (FeatureKey)

See Also

Feature.FeatureKey property

Layer.Invalidate method (Layer object)

Purpose

Causes the rectangle (in container screen coords) to be redrawn.

Syntax

Layer.Invalidate InvalidRect

Part Description

OBJECT A Layer object.

FeatureKey A string that identifies the feature. This is the value returned by Feature.FeatureKey property. This is a replacement for Feature.FeatureID (which still works as it did before, but it is recommended that you use the new FeatureKey property).

Parts Description

OBJECT This represents a Layer object.

FeatureKey A string that identifies the feature. This is the value returned by Feature.FeatureKey property

158 MapX Reference

Page 173: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.KeyField property (Layer object)

See Also

Layer.AddFeature method

Layer.AllFeatures method

Layer.DeleteFeature method

Layer.NoFeatures method

Layer.SearchAtPoint method

Layer.SearchWithinDistance method

Layer.SearchWithinFeature method

Layer.SearchWithinRectangle method

Layer.UpdateFeature method

Layer.KeyField property (Layer object)

Purpose

This string property identifies the column (field) name in the layer's mapinfo table that will be set or retrieved by the KeyValue property of a feature object. It currently defaults to the first column in the layer's table. This property does not apply to raster or userdraw layers. An error is raised if you try to set the KeyField to an invalid field name.

Layer.LabelAtPoint method (Layer object)

Purpose

Labels a particular object at a point.

Syntax

OBJECT.LabelAtPoint (x, y)

Part Description

OBJECT Represents a Layer object.

x X map coordinate of point (double value).

y Y map coordinate of point (double value).

Mapx Referenc 159

Page 174: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.LabelAtPoint method (Layer object)

Example in C++

// Layer.LabelAtPoint Method

void CSampleProjectView::OnToolUsed(short ToolNum, double X1, double Y1, double X2, double Y2, double Distance, BOOL Shift, BOOL Ctrl, BOOL* EnableDefault) {

if(ToolNum==CUSTOM_LABEL_TOOL_ID) {

CMapXPoint pt;

if(!pt.CreateDispatch(pt.GetClsid())) {

TRACE0("Failed to Create Point object");

return;

}

try {

pt.Set(X1,Y1);

// Label any item clicked on in the topmost layer

m_Map.GetLayers().Item(1).LabelAtPoint(pt);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

}

Example in Visual Basic

Private Sub Map1_ToolUsed(ByVal ToolNum As Integer, ByVal X1 _

As Double, ByVal Y1 As Double, ByVal X2 As Double, ByVal Y2 _

As Double, ByVal Distance As Double, ByVal Shift As Boolean, _

ByVal Ctrl As Boolean, EnableDefault As Boolean)

If ToolNum = CUSTOM_LABEL_TOOL_ID Then

Dim pt As New Point

pt.Set X1,Y1

' Label any item clicked on in the topmost layer

Map1.Layers(1).LabelAtPoint pt

End If

End Sub

160 MapX Reference

Page 175: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.LabelProperties property (Layer object)

Layer.LabelProperties property (Layer object)

Purpose

Label properties for the layer

See Also

LabelProperties object

Layer.Name property (Layer object)

Purpose

This property contains the name of the layer. A name is given to the layer when added.

Layer.NoFeatures method (Layer object)

Purpose

Returns am empty features object for the layer.

Syntax

OBJECT NoFeatures()

See Also

Layer.AddFeature method

Layer.AllFeatures method

Layer.DeleteFeature method

Layer.Invalidate method

Layer.SearchAtPoint method

Layer.SearchWithinDistance method

Layer.SearchWithinFeature method

Layer.SearchWithinRectangle method

Layer.UpdateFeature method

Mapx Referenc 161

Page 176: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.OverrideStyle property (Layer object)

Layer.OverrideStyle property (Layer object)

Purpose

Controls whether the style for the map features should be overridden using the Style propertyThis is a Boolean value, and the default is False.

See Also

Layer.Style property

Layer.PredominantFeatureType property (Layer object)

Purpose

A read-only property that returns an integer representing one of the FeatureTypeConstants. It is used to determine which type of feature is most prevalent in a layer.

Remarks

If the layer has an equal number of features of more than one type (eg 2 symbols and 2 regions) then predominantFetureType uses this order of precidence to determine what to return.

• symbol• line• region• misc

Layer.Refresh method (Layer object)

Purpose

This method flushes the cache from the layer. This is useful for server layers that have caching turned on.

Syntax

OBJECT Refresh

See Also

LayerInfo object

162 MapX Reference

Page 177: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.SearchAtPoint method (Layer object)

Layer.SearchAtPoint method (Layer object)

Purpose

Returns Features collection object. • Regions - if the point is within the region, the region is in the resulting collection.• Lines and Symbols - The closest point(s) or line(s) (can be multiple if many points

have same coordinates) within a 3 pixels area around the given point are added to the resulting collection.

Syntax

OBJECT.SearchAtPoint (Point)

See Also

Layer.AddFeature method

Layer.AllFeatures method

Layer.DeleteFeature method

Layer.Invalidate method

Layer.NoFeatures method

Layer.SearchWithinDistance method

Layer.SearchWithinFeature method

Layer.SearchWithinRectangle method

Layer.UpdateFeature method

Example

Private Sub Map1_MouseDown(Button As Integer, Shift As _

Integer, X As Single, Y As Single)

Dim Lon As Double

Dim lat As Double

Dim fs As Features

Dim pnt As New Point

If Map1.CurrentTool = miArrowTool Then

Map1.ConvertCoord X, Y, Lon, lat, miScreenToMap

pnt.Set Lon, lat

Set fs = Map1.Layers("US Top 20 Cities").SearchAtPoint(pnt)

Part Description

x X map coordinate of Point.

y Y map coordinate of Point.

Mapx Referenc 163

Page 178: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.SearchWithinDistance method (Layer object)

If fs.Count > 0 The

MsgBox fs.Count & ": " & fs(1).Name

Else

MsgBox "Nothing found"

End If

End If

End Sub

Layer.SearchWithinDistance method (Layer object)

Purpose

Searches for map features within a specified distance, and returns search results as a Features collection.

Syntax

OBJECT.SearchWithinDistance(Source, double Distance, short Units, short SearchType)

Remarks

This method creates a buffer region around the source object, then searches within the buffer region. After the search has been performed, the buffer is discarded; if you need to save the buffer, use the BufferFeatures method instead.

The resolution of the buffer region (i.e. the number of nodes) is controlled by the Map.DefaultConversionResolution property

Part Description

OBJECT Represents a layer object.

Source A Point object or a Feature object, representing the origin of the search.

Distance The distance to search, in the map units specified by the Units parameter

Units A MapUnitConstants value, such as miUnitMile (0), that identifies the unit of measure for the Distance argument.

SearchType A SearchTypeConstants value; controls the search criteria that are used to determine whether a feature is ”within” the search area.

164 MapX Reference

Page 179: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.SearchWithinDistance method (Layer object)

Example in Visual Basic

Private Sub SelectCustomers(state As String,pt As Point, _

distance As Double,units As Integer)

' Given a layer named "Customers Layer", find all customers

' in (state) that are within (distance) (units) from (pt)

Dim custInState As Features

Dim custInDistance As Features

Dim customersFound As Features

Dim stateFeature As FindFeature

Dim custLayer As Layer

Set custLayer = Map1.Layers("Customers Layer")

' find the state

Set stateFeature = Map1.Layers("USA").Find.Search(state)

If stateFeature.FindRC mod 10 <> 1 Then ' No exact match found

MsgBox "Couldn't find state"

Else

' find all the customers within the distance

Set custInDistance = custLayer.SearchWithinDistance _

(pt,distance,units,miSearchTypeCentroidWithin)

' find all the customers in the state

Set custInState = custLayer.SearchWithinFeature(stateFeature, miSearchTypeCentroidWitih)

' keep only the customers within the distance and

' within the state

Set customersFound = custInDistance.Clone

customersFound.Common custInState

' select these customers

custLayer.Selection.Replace customersFound

End If

End Sub

Example in C++

// Features.Clone Method

// Features.Common Method

// Layer.SearchWithinDistance Method

Mapx Referenc 165

Page 180: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.SearchWithinDistance method (Layer object)

// Layer.SearchWithinFeature Method

void CSampleProjectView::SelectCustomers(CString& state,CMapXPoint& pt,double distance,short units) {

// Given a layer named "Customers Layer", find all

// customers in (state) that are within (distance) (units)

// from (pt)

CMapXFeatures custInState;

CMapXFeatures custInDistance;

CMapXFeatures customersFound;

CMapXFindFeature stateFeature;

CMapXLayer custLayer;

try {

custLayer = m_Map.GetLayers().Item("Customers Layer").

// find the state

stateFeature = m_Map.GetLayers().Item("USA").GetFind(). Search(state);

if(stateFeature.GetFindRC() % 10 != 1) {

// No exact match found

AfxMessageBox("Couldn't find state");

return;

}

// find all the customers within the distance

custInDistance = custLayer.SearchWithinDistance(pt, distance,units,miSearchTypeCentroidWithin);

// find all the customers in the state

custInState = custLayer.SearchWithinFeature(stateFeature, miSearchTypeCentroidWithin);

// keep only the customers within the distance and

// within the state

customersFound = custInDistance.Clone();

customersFound.Common(custInState);

// select these customers

custLayer.GetSelection().Replace(customersFound);

} catch (COleDispatchException *e) {

e->ReportError();

166 MapX Reference

Page 181: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.SearchWithinFeature method (Layer object)

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

See Also

Layer.AddFeature method

Layer.UpdateFeature method

Layer.DeleteFeature method

Layer.Invalidate method

Layer.SearchWithinFeature method

Layer.SearchWithinRectangle

Layer.SearchAtPoint method

Layer.AllFeatures method

Layer.NoFeatures method

Layer.SearchWithinFeature metho (Layer object)

Purpose

Returns Features collection. SearchType is miSearchTypeCentroidWithin, miSearchTypePartiallyWithin, miSearchTypeEntirelyWithin

Syntax

OBJECT.SearchWithinFeature (Feature, SearchType)

Part Description

OBJECT Represents a Layer object.

Feature Feature object to use as basis of search.

SearchType SearchType is miSearchTypeCentroidWithin, miSearchTypePartiallyWithin, miSearchTypeEntirelyWithin.

Mapx Referenc 167

Page 182: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.SearchWithinRectangle method (Layer object)

See Also

Layer.AddFeature method

Layer.AllFeatures method

Layer.DeleteFeature method

Layer.Invalidate method

Layer.NoFeatures method

Layer.SearchAtPoint method

Layer.SearchWithinDistance method

Layer.SearchWithinRectangle method

Layer.UpdateFeature method

Layer.SearchWithinRectangle metho (Layer object)

Purpose

Returns Features collection within bounds of specified Rectangle.

Syntax

OBJECT.SearchWithinRectangle (Rectangle, SearchType)

See Also

Layer.AddFeature method

Layer.AllFeatures method

Layer.DeleteFeature method

Layer.Invalidate method

Layer.NoFeatures method

Layer.SearchAtPoint method

Layer.SearchWithinDistance methodLayer.SearchWithinFeature methodLayer.UpdateFeature method

Part Description

OBJECT Represents a Layer object.

Rectangle Feature object to use as basis of search.

SearchType SearchType is miSearchTypeCentroidWithin, miSearchTypePartiallyWithin, miSearchTypeEntirelyWithin.

168 MapX Reference

Page 183: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.Selectable property (Layer object)

Layer.Selectable property (Layer object)

Purpose

Controls whether layer is selectable using the selection tools. This property does not affect the selection process using the automation methods in the selection collection. This is a Boolean value, and the default is On/True.

Layer.Selection property (Layer object)

Purpose

A collection of selected features for the layer.

See Also

Selection collection

Layer.ShowNodes property (Layer object)

Purpose

A small box is drawn around node of an object we true. Defaults to false.

Layer.ShowCentroids property (Layer object)

Purpose

Object centroids are drawn (regions only) when true. Defaults to false.

Layer.ShowLineDirection property (Layer object)

Purpose

An arrow indicating line direction is drawn (lines and poly lines only) when true. Defaults to false.

Mapx Referenc 169

Page 184: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.Style property (Layer object)

Layer.Style property (Layer object)

Purpose

The style object used to override the appearance of all features in the layer on the map. The Style object is retrieved and filled with the new requested override values. This style is used if the Override property is set to True.

See Also

Layer.OverrideStyle property

Layer.Type property (Layer object)

Purpose

This ia a read only property that returns an integer corresponding to one of the LayerTypeConstants:

• miLayerTypeNormal = 0• miLayerTypeRaster = 2• miLayerTypeSeamless = 4• miLayerTypeUnknown = 5• miLayerTypeUserDraw = 6

Example in C++

// Layer.Type Property

void CSampleProjectView::CountLayers() {

long lCount,normCount=0,rasterCount=0,seamlessCount=0;

try {

lCount = m_Map.GetLayers().GetCount();

for(long i=1;i<=lCount;i++) {

switch(m_Map.GetLayers().Item(i).GetType()) {

case miLayerTypeNormal:

normCount++;

break;

case miLayerTypeRaster:

rasterCount++;

break;

case miLayerTypeSeamless:

seamlessCount++;

break;

// case miLayerTypeUnknown:

// case miLayerTypeUserDraw:

170 MapX Reference

Page 185: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.Type property (Layer object)

// case miLayerTypeDrilldown:

};

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

msg.Format("There are %ld normal layers, %ld raster layers, and %ld seamless layers.",normCount,rasterCount,seamlessCount);

AfxMessageBox(msg);

}

Example in Visual Basic

Private Sub CountLayers()

Dim normCount As Integer, rasterCount As Integer, _

seamlessCount As Integer

For Each Lyr In Map1.Layers

Select Case Lyr.Type

Case miLayerTypeNormal

normCount = normCount + 1

Case miLayerTypeRaster

rasterCount = rasterCount + 1

Case miLayerTypeSeamless

seamlessCount = seamlessCount + 1

'Case miLayerTypeUnknown

'Case miLayerTypeUserDraw

'Case miLayerTypeDrilldown

End Select

Next

MsgBox "There are " & normCount & " normal layers, " _

& rasterCount & " raster layers, and " & seamlessCount

& " seamless layers."

End Sub

Mapx Referenc 171

Page 186: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.UpdateFeature method (Layer object)

Layer.UpdateFeature metho (Layer object)

Purpose

Updates the target feature in the layer to have the properties of the Source feature. This method is useful for object editing.

Syntax

OBJECT UpdateFeature (FeatureKey, [Source], [RowValues])

See Also

Layer.AddFeature method

Layer.AllFeatures method

Layer.DeleteFeature method

Layer.Invalidate method

Layer.NoFeatures method

Layer.SearchAtPoint method

Layer.SearchWithinDistance method

Layer.SearchWithinFeature method

Layer.SearchWithinRectangle method

Layer.Visible property (Layer object)

Purpose

Controls whether layer is visible or not. This is a Boolean value, and the default is True.

Parts Description

OBJECT Represents a Layer object.

FeatureKey The Feature object to update. This is a replacement for FeatureID parameter. FeatureID still works as it did before, but it is recommended that you use the new FeatureKey parameter.

Source The Feature object to take the properties from. The default is Target.

RowValues Represents a RowValues collection, and contains the new values of the data columns.

172 MapX Reference

Page 187: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layer.ZoomLayer property (Layer object)

Layer.ZoomLayer property (Layer object)

Purpose

Controls whether layer is zoom layered. Zoom layering controls the range of zoom levels (distance across map) for which the layer is displayed. If Zoom Layering is on, then the values stored in the ZoomMax and ZoomMin properties are used. This is a Boolean value, and the default is False.

See Also

Layer.ZoomMin property

Layer.ZoomMax property

Layer.ZoomMax property (Layer object)

Purpose

If ZoomLayering is on (Layer.ZoomLayer property), then this specifies the maximum zoom value for which a layer will be drawn on the map. This takes a Double value specifying distance in Map units (Map.MapUnit).

See Also

Layer.ZoomLayer property

Map.MapUnit property

Layer.ZoomMin property (Layer object)

Purpose

If ZoomLayering is on (Layer.ZoomLayer property), then this specifies the minimum zoom value for which a layer will be drawn on the map. This takes a Double value specifying distance in Map units (Map.MapUnit).

See Also

Layer.ZoomLayer property

Map.MapUnit property

Mapx Referenc 173

Page 188: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layers.Add method (Layers collection)

Layers.Add method (Layers collection)

Purpose

Creates a layer object for a specified file, adds it to the collection and displays it on the map.

Syntax

OBJECT.Add ([LayerInfo], [Position])

Remarks

The layer is positioned automatically with respect to other layers in the map. For example, the layer with points is placed above a layer with regions.

If a string is passed for the LayerInfo parameter, it is treated as a file specification with the following interpretation:

• .tab extension is treated as a .tab file.• Any other extension is treated as a self-registering raster file.• No extension is treated as a geodictionary user name.

Example

Map1.Layers.Add dlgFileOpen.filename, 2

Layers.AddGeosetLayers metho (Layers collection)

Purpose

Adds the specified GeoSet to the current map. Creates Layer objects for each layer specified in the GeoSet that is not already in the Layers collection.

Syntax

OBJECT.AddGeosetLayers (GeosetName)

Part Description

OBJECT Represents a Layers object.

LayerInfo Variant: This can be either a LayerInfo object or a Pathname of the MapInfo table (.TAB) file to be added as a layer.

Position Variant: Its initial position in the layer list. If omitted or 0, the auto layer positioning algorithm is used.

Part Description

OBJECT Represents a Layers object.

GeosetName Geoset 'friendly' name or full file specification.

174 MapX Reference

Page 189: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layers.AddServerLayer method (Layers collection)

Example

Map.Layers.AddGeosetLayers "United States"

See Also

Map.Geoset property

Layers.AddServerLayer method (Layers collection)

Purpose

This adds remote spatial data to the map (i.e. a layer of features retrieved from a remote database, such as Oracle or Informix).

Syntax

OBJECT AddServerLayer (Name, ConnectString, Query, Cache, [ Position ], [Options] )

Part Description

OBJECT A Layers collection object.

Name A string indicating the name of the layer to create (e.g. ”Highways”).

ConnectString An ODBC connection string, which specifies connection information such as host name, password, etc. If the string does not provide all necessary information, the ODBC data source displays a connection dialog.You can re-use connections, thus avoiding redundant connection dialogs. If you pass a complete connection string that matches an existing string in the current connection pool, that connection will be shared by the two tables. The password does not need to be in the connection string for the two strings to match.

Query A string that specifies a GISSQL/Server-specific SQL query.

Cache

Position Optional: The position in the list of layers. To make this layer the top layer in the map, specify 1 (one).

Options Optional: Accepts a bitwise OR of the LayerSrvLayerOptions values, which control the behavior of the server layer. The default value is (miLayerCacheOn OR miMBRSearchOn).The reason for this distinction is that while in VB, the OR operator is used for both logical and bitwise OR, C++ has different operators for each. Someone embedding MapX in a C++ app should know the correct OR to use.This allows control of certain behavior of a server layer (presently the cache and the MBRsearch options). It does not take a boolean. It takes a set of flags (bitmask) as described below. Use the enumerated values provided and simply OR them together to define the SrvLayerOptions value before calling AddServerLayer

Mapx Referenc 175

Page 190: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layers.AddUserDrawLayer method (Layers collection)

Remarks

The AddServerLayer method is included for backwards compatibility. The preferred method for performing the same function is simply the Layers.Add method. The LayerInfo object passed to the Add method allows you to specify that the layer is a server layer and to control the cache and MBR search.

The following table summarizes the effect of the Options parameter. The constants can be bitwise "or-ed" together to combine options.

See Also

Layers.Add

LayerInfo object

Layers.AddUserDrawLayer metho (Layers collection)

Purpose

Adds a layer that the container application is responsible for drawing to. Used in conjunction with the DrawUserLayer event, which is fired when the layer needs to get drawn. Returns newly created Layer object

miLayerCacheOn Attributes and objects which have been read in will be kept in memory. This will make map interaction (such as zooming and panning) faster. However, the latest updates to the data will not be shown until Layer.Refresh is called.

miLayerCacheOff All data will be fetched from the database each time the layer is drawn. This will be less efficient, but it will give the most up to date data..

miLayerMBRSearchOn This will cause an MBRSearch predicate to be added to the spatial query when retrieving the data.

miLayerMBRSearchOff Turns off the MBRSearch predicate that is appended to the query when the Map is drawn. This is useful for queries which already contain a spatial predicate and where an additional spatial predicate should be avoided.

176 MapX Reference

Page 191: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layers.AnimationLayer property (Layers collection)

Syntax

OBJECT.AddUserDrawLayer (Name, Position)

Layers.AnimationLayer property (Layers collection)The animation layer is useful where map features need to be updated frequently, such as in real-time applications. For example, you can develop a fleet-management application that represents each vehicle as a point object. You can receive current vehicle coordinates by using GPS (Global Positioning Satellite) technology, and then update the point objects to show the current vehicle locations on the map. In this type of application, where map objects are constantly changing, the map redraws much more quickly if the objects being updated are stored in the animation layer instead of a conventional layer.

Initially AnimationLayer is set to null. You can assign a Layer object to the property to make that Layer the animation layer (it can be a regular layer or user draw layer). When a layer is assigned to the AnimationLayer property, it is drawn on top of all layers, including the annotations layer and selections. The layer is still in the same position in the layers collection. Floating objects like legends are still displayed on top of the animation layer, although they don't have to be re-drawn each time because they are clipped out. If a normal layer is used as the animation layer, selections and labeling will still work.

To turn off the animation layer, you assign null to it:

Set Map.Layers.AnimationLayer = nothing

This turns the layer back into a normal layer, which is still positioned in the same place in the layer list.

Example

Set Map.Layers.AnimationLayer = Layers(3)

for each lyr in Map.Layers

if Map.Layers.AnimationLayer = lyr then

...

end if

next

Parts Description

OBJECT Represents a Layers object.

Name Name of layer to create

Position Where to add the layer in the layer list.

Mapx Referenc 177

Page 192: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layers.Bounds property (Layers collection)

Layers.Bounds property (Layers collection)

Purpose

Returns a Rectangle object representing the geographic extents of all layers in the collection (except the UserDraw layer).

Example in C++

// Layers.Bounds Property

void CSampleProjectView::ViewAllLayers() {

// Set the boundaries of the map view to be the boundaries of all of the layers

try {

m_Map.SetBounds(m_Map.GetLayers().GetBounds());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub ViewAllLayers_Click()

' Set the window boundaries of the map to be the boundaries

' of all of the layers

Map1.Bounds = Map1.Layers.Bounds

End Sub

Remarks

This property is useful if you want to zoom the map out far enough to show all objects in all layers.

See Also

Layer.Bounds property

178 MapX Reference

Page 193: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layers.ClearSelection method (Layers collection)

Layers.ClearSelection metho (Layers collection)

Purpose

Deselects features in all layers of the Layers collection.

See Also

Selection.ClearSelection

Layers.Count property (Layers collection)

Purpose

Contains the number of Layer objects in the collection. This is an Integer value and is read-only.

Layers.CreateLayer metho (Layers collection)

Purpose

The CreateLayer method allows you to create a new temporary or permanent MapInfo table layerThe created table has a column for the feature name, which is used by labeling and data binding. When you add or update a feature, the Name property is put into the feature name column.

Syntax

OBJECT CreateLayer (Name , [FileSpec] , [Position] , [KeyLength] , [CoordSys])

Part Description

OBJECT A Layers collection object.

Name A name to refer to the layer by (the username of the layer).

FileSpec Variant: The pathname of where to create the layer. The filename should include the .tab extension. The other files that make up a MapInfo table (.map, .dat, etc.) are created in the same directory as the .tab file. If no filename is given, then a temporary layer is created, which will be deleted when then map or ocx is destructed.

Position Variant: Its initial position in the layer list. If omitted, the auto layer positioning algorithm assigns a layer order based on the type of layer

KeyLength Variant: The length of the column added to the table to hold the feature names. If omitted, the default is 32.

CoordSys Variant: A CoordSys object that specifies the coordinate system in which the new layer is stored. Optional; if omitted, the Map.NumericCoordSys property is used.

Mapx Referenc 179

Page 194: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layers.InsertionLayer (Layers object)

Remarks

The method returns a Layer object-the Layer object that was added to the collection. The new layer is created with a key column named "GEONAME".

Example in Visual Basic

Dim lyr As MapXLib.Layey

' create temporary layer to be used as animation layer

' put in first position in layer list and use default keylength

Set lyr = Map1.Layers.CreateLayer("tempAnimate", ,1)

Set Map1.Layers.AnimationLayer = lyr

Example in C++

void CSampleProjectView::CreateAnimationLayer() {

CMapXLayer lyr;

try {

// Create temporary layer to be used as animation layer

// Put in first position in layer list and use default keylength

lyr=m_Map.GetLayers().CreateLayer("tempAnimate",NULL,1);

m_Map.GetLayers().SetAnimationLayer(lyr);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Layers.InsertionLayer (Layers object)

Purpose

This property specifies what layer new objects will be inserted into by the built-in object editing tools. Initially InsertionLayer is set to null. You can assign a Layer object to the property to make that Layer the InsertionLayer (see code example)

180 MapX Reference

Page 195: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layers.Item property (Layers collection)

Example in Visual Basic

'Make layer USA the insertion layer

dim lyrInsertion as MapXlib.Layer

set lyrInsertion = Map1.Layers("USA")

lyrInsertionLayer.Editable = True

Set Map1.Layers.InsertionLayer = lyrInsertion

Remarks

You cannot make a drill-down, raster, seamless or user-draw layer the insertion layer.

The layer's editable property must be set to true before you can make that layer the InsertionLayer.

At any time only one layer can be designated the insertion layer.

The AddPoint, AddLine, AddRegion and AddPolyLine stock tools (object creation tools) will add features to the layer designated as the insertion layer

You cannot set Map.CurrentTool to any of the object creation tools until you've specified an insertion layer.

Layers.Item property (Layers collection)

Purpose

Gets a specific Layer object from the collection. Item takes either an index (Integer value starting at 1), or a layer name, to specify which Layer object to get.

Layers.LayersDlg method (Layers collection)

Purpose

Presents a dialog where the user can add layers, remove layers, change layer ordering, and change layer properties. If the user clicks OK, the changes made within the dialog will immediately be applied to the map.

Mapx Referenc 181

Page 196: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layers.LayersDlg method (Layers collection)

Syntax

[Boolean=]OBJECT.LayersDlg ([HelpFile], [HelpID])

Remarks

If you specify both the HelpFile and the HelpID, the dialog includes a Help button; if the user clicks the Help button, MapX displays the specified Help topic.

The return value of LayersDlg is True if the user clicked OK and False if the user clicked Cancel.

Part Description

OBJECT A Layers collection.

HelpFile Variant: The file name of a Windows Help file. (optional)

HelpID Variant: The ID number of a topic in the Help file. (optional)

182 MapX Reference

Page 197: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layers.Move method (Layers collection)

Example

The following statement displays the Layer Control dialog box

Map1.Layers.LayersDlg

Layers.Move metho (Layers collection)

Purpose

Moves a layer in the Layer collection to change the order in which layers are drawn.

Syntax

OBJECT.Move (From, To)

Example in C++

// Layers.Move Method

void CSampleProjectView::Rearrange() {

// Move the lowest layer to the top

try {

m_Map.GetLayers().Move(m_Map.GetLayers().GetCount(),1);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub Rearrange()

' Move the lowest layer to the top

Map1.Layers.Move Map1.Layers.Count,1

End Sub

Parts Description

OBJECT Represents a Layers object.

From Index number of the layer to move. The topmost layer is 1.

To New location for the layer. For example, if you want it to be the second layer, use 2.

Mapx Referenc 183

Page 198: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layers. Remove method (Layers collection)

Remarks

The order of layers in the Layer collections controls draw order. When layers are added using Layers.Add or Layers.AddGeosetLayers, the layers are intelligently inserted into the layer collection. For example, layers with points are put above layers with lines, and layers with lines are put above layers with regions, and layers with regions are put above raster layers.

See Also

Layers collection

Layers. Remove metho (Layers collection)

Purpose

Removes a Layer object from the collection. This has the effect of removing the layer from the map.

Note: If you remove an item, the collection indexes are renumbered to fill in the hole left by the item removed.

Syntax

OBJECT.Remove (Index)

Layers.RemoveAll method (Layers collection)

Purpose

Removes all Layer objects from the collection.

Syntax

Layers.RemoveAll

Part Description

OBJECT Represents a Layers object.

Index Either an Integer index value (starting at 1), or the name of the layer to remove.

184 MapX Reference

Page 199: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layers.RemoveAll method (Layers collection)

Example in Visual Basic

Private Sub btnLayersRemoveAll_Click()

Dim nLayers As Integer

nLayers = Map1.Layers.Count

' remove all of the layers

Map1.Layers.RemoveAll

nLayers = Map1.Layers.Count

End Sub

Example in C++

void CSampleProjectView::RemoveAllLayers() {

try {

m_Map.GetLayers().RemoveAll();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Mapx Referenc 185

Page 200: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Layers.RemoveAll method (Layers collection)

186 MapX Reference

Page 201: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LayerInfo object

The LayerInfo object stores parameters to be passed to the Layers.Add method and specifies type from the LayerInfoType constants.

The table below displays the parameters that need to be used for each layer type.

LayerInfoType Description Parameter Required Type

miLayerInfoTypeTab FileSpec Yes String: File specification of the .tab file to open

Name No String: Name of the added layer

miLayerInfoTypeUserDraw Name Yes String: Name of the added layer

miLayerInfoTypeRaster FileSpec Yes String: File specification of the self-registering raster file to open

Name No String: Name of the added layer

miLayerInfoTypeShape FileSpec Yes String: File specification of the .shp file

Name No String: Name of the added layer

CoordSys Yes CoordSys Object: Coordinate System in which object data is stored in the .shp file.

Style No Style Object: Style to use in rendering the objects.

miLayerInfoTypeServer Name Yes String: Name of the added layer

ConnectString Yes String: ODBC connection string (see AddServerLayer)

Query Yes String: SQL Query (see AddServerLayer)

ToolKit Yes String: ToolKit option, either ODBC or ORAINET

Page 202: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LayerInfo object

For any LayerInfoType other than miLayerInfoTypeUserDraw or miLayerInfoTypeRaster, the

following options are also supported:

Object Properties• LayerInfo.Type property (LayerInfo object)

Object Methods• LayerInfo.AddParameter method (LayerInfo object)

Example

Dim LayerInfoObject As New LayerInfo

LayerInfoObject.Type = miLayerInfoTypeTab

LayerInfoObject.AddParameter "FileSpec", "c:\Program _

Files\MapInfo MapX 4.0\Maps\worldcap.tab"

LayerInfoObject.AddParameter "Name", "My New Layer"

Map1.Layers.Add LayerInfoObject

See Also

Layers.Add method

Cache No String: Either ON or OFF. Default is OFF.

MBRSearch No String: Either ON or OFF. Default is OFF.

miLayerInfoTypeGeodictUserName Name Yes String: Name of the layer to add (as stored in the Geodictionary).

Any AutoCreateDataset No Numeric: if 1, then a dataset of type miDatasetLayer is added after the layer is added. If 0 (the default), no dataset is added.

Any DatasetName No String: If the AutoCreateDataset parameter is 1, then this will be the name of the new dataset. If not specified, a default name is used.

Any Cache No String: Either ON or OFF, specifying whether to cache the data fetched from server layers. Default is OFF.

LayerInfoType Description Parameter Required Type

188 MapX Reference

Page 203: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LayerInfo.Type property (LayerInfo object)

LayerInfo.Type property (LayerInfo object)

Purpose

This is a read/write property whose value is one of the LayerTypeConstants

See Also

LayerInfo.AddParameter method

Layers.Add method

LayerInfoTypeConstants

LayerInfo.AddParameter metho (LayerInfo object)

Purpose

The Addparameter method adds to the set of parameters required for a given call to the Layers.Add method. The necessary parameters are determined by the type property of the LayerInfo object.

Syntax

OBJECT AddParameter (name, value)

See Also

Layers.Add method

LayerInfo object

Parts Description

OBJECT This represents a LayerInfo object.

name The name of the parameter.

value The value of the parameter.

Mapx Referenc 189

Page 204: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LayerInfo.AddParameter method (LayerInfo object)

190 MapX Reference

Page 205: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Legend object

Purpose

Each Theme object has a Legend object (Theme.Legend). The Legend object contains properties to control the display of a theme's legend. Each ThemeCategory object (RangeCategory, IndividualValueCategory, or MultiVarCategory) has an entry in the legend contained in a LegendText object.

Object Properties• Legend.BodyTextStyle property (Legend object)• Legend.Compact property (Legend object)• Legend.CompactTitle property (Legend object)• Legend.CompactTitleStyle property (Legend object)• Legend.CurrencyFormat property (Legend object)• Legend.Height property (Legend object)• Legend.Left property (Legend object)• Legend.LegendTexts property (Legend object)• Legend.PaperHeight property (Legend object)• Legend.PaperWidth property (Legend object)• Legend.ShowCount property (Legend object)• Legend.ShowEmptyRanges property (Legend object)• Legend.SubTitle property (Legend object)• Legend.SubTitleStyle property (Legend object)• Legend.Title property (Legend object)• Legend.TitleStyle property (Legend object)• Legend.Top property (Legend object)• Legend.Visible property (Legend object)• Legend.Width property (Legend object)

Object Methods• Legend.ExportLegend method (Legend object)• Legend.LegendDlg method (Legend object)• Legend.PrintLegend method (Legend object)

Page 206: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Legend.BodyTextStyle property (Legend object)

Legend.BodyTextStyle property (Legend object)

Purpose

This is a Style object which controls the text style for the legend body. This is a Style object and may be set to an existing style object or you may set the style properties individually.

See Also

Style object

Legend.Compact property (Legend object)

Purpose

Controls whether the legend is compact (1 line) or full sized. This is a Boolean value, and defaults to the setting of Map.PreferCompactLegends.

See Also

Map.PreferCompactLegends property

Legend.CompactTitle property (Legend object)

Purpose

Contains the compact legend title text string. This is displayed when the legend is compact sized. This is a String value, and a default title is created when the thematic map is created.

Legend.CompactTitleStyle property (Legend object)

Purpose

This is a Style object which controls the text style for the compact title. This is a Style object and may be set to an existing style object or you may set the style properties individually.

See Also

Style object

Legend.CurrencyFormat property (Legend object)

Purpose

Controls whether numbers are displayed using a currency format or a standard number format. This is a Boolean value, and defaults to False.

192 MapX Reference

Page 207: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Legend.ExportLegend method (Legend object)

Legend.ExportLegend method (Legend object)

Purpose

Exports an image of the Legend to a file or to the clipboard.

Syntax

OBJECT ExportLegend (Destination, Format)

See Also

Map.ExportMap

Legend.Height property (Legend object)

Purpose

Contains the height of the legend in screen units. This is a Single value, and is a Read-only property

Legend.Left property (Legend object)

Purpose

Contains the position of the left edge of the legend in screen units, relative to the upper left corner of the map control. This is a Single value.

Note: You can drag the legend outside the bounds of the MapX control in a form and not be able to drag it back (if you release the mouse button with the legend off the screen).

It is possible, however, to programmatically reset the Left and Top properties of the object to be within the bounds of the map. This also applies to map titles and annotations.

Part Description

OBJECT Represents a Legend object.

Destination File specification of where to put the output, such as ”C:\Temp\Legend.bmp”. If you specify ”CLIPBOARD” instead of a file path, the image is put on the clipboard.

Format Output format. This takes an ExportFormatConstants value. Note: If you specify miFormatGIF (to generate GIF files), please read the Licensing Requirements for Users of GIF Files. If you direct output to CLIPBOARD, the format must be metafile or bitmap.

Mapx Referenc 193

Page 208: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Legend.LegendDlg method (Legend object)

Legend.LegendDlg method (Legend object)

Purpose

Presents a dialog where the user can adjust legend settings (altering the property values of the legend object through a user interface). If the user clicks 'OK', the changes made within the dialog will immediately be applied to the map.

Syntax

[Boolean=]OBJECT.LegendDlg([ HelpFile ] [ HelpID ])

Remarks

If either of the optional parameters are not given, the help button will not appear on the dialog.

The return value of LegendDlg is True if the user clicked OK and False if the user clicked Cancel.

Example in Visual Basic

'This example displays the Legend Dialog

'for a theme when its legend is double-clicked

Private Sub Map1_ThemeModifyRequested(ByVal Theme As Object)

Theme.Legend.LegendDlg

End Sub

Example in C++

void OnThemeModifyRequested(LPDISPATCH ThemeDispatch) {

CMapXTheme theme;

theme.AttachDispatch(ThemeDispatch, FALSE); // Get theme object

try {

theme.GetLegend().LegendDlg();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

Part Description

OBJECT Represents a Legend object.

HelpFile HelpFile is an optional parameter that is a pathname to a .hlp file that contains help topics for the dialog.

HelpID HelpID is an optional parameter that refers to the ID of a specific help topic within the given .hlp file.

194 MapX Reference

Page 209: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Legend.LegendTexts property (Legend object)

e->Delete();

}

}

Legend.LegendTexts property (Legend object)

Purpose

A collection of Legendtext objects for the legend. Ranged, Individual Value, Pie, Bar and Dot Density themes have one LegendText item per category. Graduated Symbol has three.

See Also

LegendText object and LegendTexts collection

Legend.PaperHeight property (Legend object)

Purpose

Contains the paper height of the legend in Map.PaperUnit units. This is a Single value, and is a Read-only property

See Also

Map.PaperUnit property

Legend.PaperWidth property (Legend object)

Purpose

Contains the paper width of the legend in Map.PaperUnit units. This is a Single value, and is a Read-only property

See Also

Map.PaperUnit property

Mapx Referenc 195

Page 210: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Legend.PrintLegend method (Legend object)

Legend.PrintLegend metho (Legend object)

Purpose

Prints the legend in the specified rectangle to the specified device context.

Syntax

OBJECT.PrintLegend (hDC, x, y, w, h)

Remarks

The current legend is drawn to fit the rectangle given. Best results are obtained when the aspect ratio of width to height is maintained.

Example in Visual Basic

Private Sub btnPrintLegend_Click()

Dim Legend as MapXLib.Legend

' there is no Printer.StartDoc method, it seems it is done

' implicitly when you use one of the printer.print methods

' so we need to print something before we print our legend

' to start the page

Printer.CurrentX = 0

Printer.CurrentY = 0

Printer.Print " "

Set Legend = Map1.Datasets(1).Themes(1).Legend

' Print legend same width and height as is shown on the map

' coords must be in himetric

' Assumes a screen device with 96 pixels per inch (most are)

' There are 2540 himetric units per inch

' Legend.Width and Height are returned in Screen units

'(pixels)

' so conversion from pixels to himetric is

' pixels/pixelsperinch * himetricperinch

Part Description

OBJECT Represents a Legend object.

hDC Printer device context. Can be any device context.

x Upper left corner X in HIMETRIC units.

y Upper left corner Y in HIMETRIC units.

w Width in HIMETRIC units.

h Height in HIMETRIC units.

196 MapX Reference

Page 211: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Legend.PrintLegend method (Legend object)

Legend.PrintLegend Printer.hDC, 0, 0, Legend.Width / _

96 * 2540, Legend.Height / 96 * 2540

' This example prints a legend in the upper left that

' is 4 by 3 inches

' 4 by 3 inches (2540 himetric units per inch)

'Map1.Datasets(1).Themes(1).Legend.PrintLegend Printer.hDC,

'0, '0, 10160, 7620

' VB4 needed an explicit NewPage before the EndDoc,

' but VB5 doesn't

'Printer.NewPage ' Send new page.

Printer.EndDoc ' Printing is finished.

End Sub

Example in C++

void CSampleProjectView::OnPrintLegend(CDC* pDC, CPrintInfo* pInfo) {

try {

CMapXLegend Legend = m_Map.GetDatasets().Item(1).GetThemes().Item(1).GetLegend();

// Print legend the same width and height as it is shown on the map

m_Map.SetPaperUnit(miUnitMillimeters);

// PrintLegend takes coordinates in HIMETRIC (100ths of a Millimeter)

double pw = Legend.GetPaperWidth() * 100.0;

double ph = Legend.GetPaperHeight() * 100.0;

Legend.PrintLegend((long)pDC->m_hDC,0,0,(long)pw,(long)ph);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Mapx Referenc 197

Page 212: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Legend.ShowCount property (Legend object)

Legend.ShowCount property (Legend object)

Purpose

Controls whether or not to show on the legend the count portion of the ranges. This takes a Boolean value, and the default is True.

Example in Visual Basic

Private Sub btnLegendShowCount_Click()

Dim lgnd As MapXLib.Legend

Set lgnd = Map1.Datasets(1).Themes(1).Legend

' This makes the counts, next to the legend's ranges,

' invisible

lgnd.ShowCount = False

End Sub

Example in C++

void CSampleProjectView::LegendShowCount() {

try {

CMapXLegend lgnd = m_Map.GetDatasets().Item(1).GetThemes().Item(1).GetLegend();

// This makes the counts, next to the legend's ranges, invisible

lgnd.SetShowCount(FALSE);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

198 MapX Reference

Page 213: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Legend.ShowEmptyRanges property (Legend object)

Legend.ShowEmptyRanges property (Legend object)

Purpose

Read/write Boolean property; determines whether empty ranges (ranges that do not contain any features) are displayed in the legend. The default is False.

Legend.SubTitle property (Legend object)

Purpose

This is a read/write string value that contains the legend subtitle text string. This is displayed when the legend in normal sized. . A default subtitle is created when the thematic map is created.

Legend.SubTitleStyle property (Legend object)

Purpose

This returns a read/write style object which controls the text style for the legend subtitle. This is a Style object and may be setto an existing style object or you may set the style properties individually.

See Also

Style object

Legend.Title property (Legend object)

Purpose

Contains the legend title text string. This is displayed when the legend in normal sized. This is a String value. A default title is created when the thematic map is created.

Legend.TitleStyle property (Legend object)

Purpose

This is a Style object which controls the text style for the title. This is a Style object and may be set to an existing style object or you may set the style properties individually.

See Also

Style object

Mapx Referenc 199

Page 214: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Legend.Top property (Legend object)

Legend.Top property (Legend object)

Purpose

Contains the position of the top edge of the legend in screen units, relative to the upper left corner of the map control. This is a Single value.Note: You can drag the legend outside the bounds of the MapX control in a form and not be able to drag it back (if you release the mouse button with the legend off the screen).It is possible, however, to programmatically reset the Left and Top properties of the object to be within the bounds of the map. This also applies to map titles and annotations.

Legend.Visible property (Legend object)

Purpose

Controls whether the legend is visible or not. This is a Boolean value, and the default is True.

Legend.Width property (Legend object)

Purpose

Contains the width of the legend in screen units. This is a Single value, and is a Read-only property

Example in C++

// Legend.Visible Property

// Legend.Top Property

// Legend.Left Property

void CSampleProjectView::LegendMove(CMapXLegend& posLegend) {

// move the legend to the top left corner of the screen

try {

posLegend.SetVisible(TRUE);

posLegend.SetLeft(0);

posLegend.SetTop(0);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

200 MapX Reference

Page 215: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Legend.Width property (Legend object)

Example in Visual Basic

Private Sub LegendMove(posLegend As Legend)

' move the legend to the top left corner of the screen

posLegend.Visible = True

posLegend.Left = 0

posLegend.Top = 0

End Sub

Mapx Referenc 201

Page 216: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Legend.Width property (Legend object)

202 MapX Reference

Page 217: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LegendText object and LegendTexts collection

Purpose

Each Theme has a collection of LegendText objects called LegendTexts. Each object (each line under the title) of a legend has a LegendText object in this collection which may be manipulated individually.

• miThemeRanged has one LegendText per range (per RangeCategory).• miThemeIndividualValue, miThemePieChart, and miThemeBarChart have

oneLegendText per category (per IndividualValueCategory or per MultiVarCategory).

• miGradSymbol has 3 LegendTexts - one for each sample size.• miDotDensity has one LegendText.

Object Properties• LegendTexts.AllOthersText property (LegendTexts collection)• LegendText.Text property (LegendText object)• LegendText.Visible property (LegendText object)

Collection Properties• LegendTexts.AutoGenerate property (LegendTexts collection)• LegendTexts.Count property (LegendTexts collection)• LegendTexts.Item property (LegendTexts collection)

See Also

Theme object

LegendTexts.AllOthersText property (LegendTexts collection)

Purpose

Returns a LegendText object from a collection. This LegendText object is associated with the AllOthersCategory property of either the RangeCategories collection or IndividualValueCategories collection. You can set the properties of the AllOthersText property like any other LegendText object.

Page 218: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LegendText.Text property (LegendText object)

Example in Visual Basic

Dim ds As Dataset

Dim lyr as Layer

Dim thm As MapXLib.Theme

Dim AllOthersText As MapXLib.LegendText

Dim lgnd As MapXLib.Legend

Map1.Geoset = "Canada.gst"

Set lyr = Map1.Layers.Item("canada")

Set ds = Map1.Datasets.Add(miDataSetLayer, lyr)

ds.Themes.Add miThemeRanged, "POP_1994", "My Theme", False

Set thm = ds.Themes("My Theme")

Set lgnd = ds.Themes("My Theme").Legend

thm.DataMin = 10000000

thm.DataMax = 30000000

thm.Visible = True

Set AllOthersText = lgnd.LegendTexts.AllOthersText

AllOthersText.Text = "Test Range"

AllOthersText.Visible = True

LegendText.Text property (LegendText object)

Purpose

Contains the text for a range or category in a legend. This is a String value, and a default is set when the thematic map is created. The legend text is automatically recomputed whenever the Theme object is recomputed (for example, number of ranges changed to 6), unless the LegendTexts.AutoGenerate property is set to False.

Example in Visual Basic

' This example sets each LegendText Object in the Map

' to "XXXXXX//" when the legend is double clicked on.

Private Sub Map1_ThemeModifyRequested(ByVal Theme As Object)

Dim legText as MapXLib.LegendText

Dim iCount as Integer

' Prevent MapX from over-writing the custom LegendText

' objects if our theme is ever recomputed

Theme.Legend.LegendTexts.AutoGenerate = False

204 MapX Reference

Page 219: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LegendText.Text property (LegendText object)

For iCount = 1 to Theme.Legend.LegendTexts.Count

Theme.Legend.LegendTexts(iCount).Text = "XXXXXX" & _Str$(iCount)

Next

End Sub

Example in C++

// This example sets each LegendText Object in the Map to

// "XXXXXX#" when the legend is double clicked on

void CSampleProjectView::OnThemeModifyRequested(LPDISPATCH ThemeDispatch) {

CMapXTheme theme;

long TextsCount,i;

CString str;

theme.AttachDispatch(ThemeDispatch,FALSE);

try {

TextsCount = theme.GetLegend().GetLegendTexts().GetCount();

// Prevent MapX from over-writing the custom LegendText

// objects if the theme is ever recomputed

theme.GetLegend().GetLegendTexts().SetAutoGenerate(FALSE);

for(i=1;i<=TextsCount;i++) {

str.Format("XXXXXX%d",i);

theme.GetLegend().GetLegendTexts().Item(i).SetText(str);

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

See Also

Theme object

Theme.AutoRecompute property

Mapx Referenc 205

Page 220: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LegendText.Visible property (LegendText object)

LegendText.Visible property (LegendText object)

Purpose

Controls whether ranges are visible for the legend. This takes a Boolean value, and the default is True.

Example in Visual Basic

Private Sub btnLegendTextVisible_Click()

Dim lgnd As MapXLib.Legend

Set lgnd = Map1.Datasets(1).Themes(1).Legend

' Make all of the ranges in the legend invisible.

nRanges = lgnd.LegendTexts.Count

For iRange = 1 To nRanges

lgnd.LegendTexts(iRange).Visible = False

Next

End Sub

Example in C++

void CSampleProjectView::MakeRangesInvisible() {

CMapXLegend lgnd;

long nRanges,i;

try {

lgnd = m_Map.GetDatasets().Item(1).GetThemes().Item(1).GetLegend();

nRanges = lgnd.GetLegendTexts().GetCount();

for(i=1;i<=nRanges;i++) {

lgnd.GetLegendTexts().Item(i).SetVisible(FALSE);

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

206 MapX Reference

Page 221: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LegendTexts.AutoGenerate property (LegendTexts collection)

LegendTexts.AutoGenerate property (LegendTexts collection)

Purpose

Controls whether the LegendText values should be re-computed by MapX when the Theme object is recomputed. This is a Boolean value, and the default is True. If you are going to modify the LegendText values, you should set this to False, so MapX doesn't override your changes.

See Also

Theme.AutoRecompute

LegendTexts.Count property (LegendTexts collection)

Purpose

The number of LegendText objects in the collection. This is a read-only property.

LegendTexts.Item property (LegendTexts collection)

Purpose

Retrieve a particular LegendTexts object from a collection. Specify the text string.

Mapx Referenc 207

Page 222: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LegendTexts.Item property (LegendTexts collection)

208 MapX Reference

Page 223: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map object

Maps are the basic building blocks for MapX. Each map is defined by DataSet, Layer and Annotations objects and collections.

Object Properties• Map.Annotations property (Map object)• Map.AreaUnit property (Map object)• Map.AutoRedraw property (Map object)• Map.BackColor property (Map object)• Map.Bounds property (Map object)• Map.CenterX property (Map object)• Map.CenterY property (Map object)• Map.CurrentTool property (Map object)• Map.DataSet property (Map object)• Map.DataSetGeoField property (Map object)• Map.DataSets property (Map object)• Map.DataSetTheme property (Map object)• Map.DefaultConversionResolution property (Map object)• Map.DefaultStyle property (Map object)• Map.DisplayCoordSys property (Map object)• Map.ExportSelection property (Map object)• Map.FeatureFactory property (Map object)• Map.GeoDictionary property (Map object)• Map.GeoSet property (Map object)• Map.GeoSets property (Map object)• Map.GeoSetWidth property (Map object)• Map.hWnd property (Map object)• Map.InfotipSupport property (Map object)• Map.InfotipPopupDelay property (Map object)• Map.Layers property (Map object)• Map.MapUnit property (Map object)• Map.MapPaperHeight property (Map object)• Map.MapPaperWidth property (Map object)• Map.MapScreenHeight property (Map object)• Map.MapScreenWidth property (Map object)• Map.MatchNumericFields property (Map object)• Map.MatchThreshhold property (Map Object) 231• Map.MaxSearchTime property (Map object)• Map.MouseIcon property (Map object)• Map.MousePointer property (Map object)• Map.MouseWheelSupport property (Map object)

Page 224: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map object

• Map.NumericCoordSys property (Map object• Map.PanAnimationLayer property (Map object)• Map.PaperUnit property (Map object)• Map.PreferCompactLegends property (Map object)• Map.RedrawInterval property (Map object)• Map.Rotation property (Map object)• Map.SaveMapAsGeoset method (Map object)• Map.SearchPath property (Map object)• Map.SelectionStyle property (Map object)• Map.Title property (Map object)• Map.TitleText property (Map object)• Map.Version property (Map object)• Map.WaitCursorEnabled property (Map object)• Map.Zoom property (Map object)

Object Methods• Map.AboutBox method (Map object)• Map.ClipLine method (Map object)• Map.CliplineV method (Map object)• Map.ConvertCoord method (Map object)• Map.ConvertCoordV method (Map object)• Map.CreateCustomTool method (Map object)• Map.Distance method (Map object)• Map.ExportMap method (Map object)• Map.IsPointVisible method (Map object)• Map.Pan method (Map object)• Map.PrintMap method (Map object)• Map.PropertyPage method (Map object)• Map.Refresh method (Map object)• Map.SetSize method (Map object)• Map.ZoomTo method (Map object)

See Also

DataSet objects

Layer object

Annotations objects

210 MapX Reference

Page 225: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.AboutBox method (Map object)

Map.AboutBox method (Map object)

Purpose

Displays the About Box, which contains information such as the version of MapX and proper credits.

Syntax

OBJECT AboutBox

Map.Annotations property (Map object)

Purpose

A collection of annotations for the map.

See Also

Annotation object and collection

Map.AreaUnit property (Map object)

Purpose

Units used in Area methods/properties. Takes an AreaUnitConstants value. Default is miUnitSquareMile.

Map.AutoRedraw property (Map object)

Purpose

Temporarily turn off screen updating. It takes a Boolean value. This is a Read/Write property.

Remarks

Set AutoRedraw to FALSE to turn screen updating off, or TRUE to resume normal screen updating.

When property or methods cause the map to change (such as Map.Zoom), the map gets redrawn. If you want to make several changes to the map, this property lets you turn off redrawing, make the several changes, then turn redrawing back on. This will prevent the numerous redraws you would get otherwise. When set to TRUE, the entire map is redrawn.

Mapx Referenc 211

Page 226: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.AutoRedraw property (Map object)

Example in C++

void CSampleProjectView::OnChangeMap() {

try {

// Temporarily disable redraws while we change the _

map parameters

// If this was not here, MapX might redraw the screen _

after each change to the Map

m_Map.SetAutoRedraw(FALSE);

// Zoom in, offset, and rotate the Map

// Note: the Map.ZoomTo method can also be used

m_Map.SetZoom(m_Map.GetZoom()*0.5);

m_Map.SetCenterX(m_Map.GetCenterX()+5.0);

m_Map.SetCenterY(m_Map.GetCenterY()-5.0);

m_Map.SetRotation(30);

m_Map.SetAutoRedraw(TRUE);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

' Turn off map redraws.

Map1.AutoRedraw = Fals

' Using the map's PropertyPage dialog, add/remove some layers from the map.

Map1.PropertyPage

' Turn map redraws back on and see the new layers.

Map1.AutoRedraw = Tru

212 MapX Reference

Page 227: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.BackColor property (Map object)

Map.BackColor property (Map object)

Purpose

Controls what color the background of the map is 'erased' with before drawing the map. Specify an OLE_COLOR value. It can be a specific solid color or one of the Windows System Colors such as 'Window Background'. (Most containers like Visual Basic display a special color picker dialog in their property pages for properties of type OLE_COLOR.)

See Also

OLE_COLOR Values

Map.Bounds property (Map object)

Purpose

The Map.Bounds property (which was called Map.MBR in earlier versions) enables you to set the bounds of the map window in map coordinates. It takes a Rectangle object.

Example in Visual Basic

dim rect as new MapXLib.Rectangle

'correct way to set the map's bounding rectangle

rect.Set -124.82, 18.08, -52.14, 53.01

set map1.Bounds = rect

'incorrect way to set bounds7 - This will have no effect.

map1.Bounds.Set -124.82, 18.08, -52.14, 53.01

Example in C++

void CSampleProjectView::SetBounds() {

CMapXRectangle rect;

if(!rect.CreateDispatch(rect.GetClsid())) {

TRACE0("Could not Create rectangle object");

return;

}

try {

// The correct way to set the map's bounding rectangle

rect.Set(-124.82,18.08,-52.14,53.01);

m_Map.SetBounds(rect);

// Incorrect way- this will have no effect

m_Map.GetBounds().Set(-124.82,18.08,-52.14,53.01);

Mapx Referenc 213

Page 228: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.CenterX property (Map object)

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

See Also

Rectangle object

Map.CenterX property (Map object)

Purpose

Sets the current X coordinate for the center of the map. This property is a Double representing the longitude (negative values for the Western hemisphere).

Discussion

The CenterX property is set when a new Geoset is loaded.

See Also

Map.CenterY property

Map.ZoomTo method

Map.CenterY property (Map object)

Purpose

Sets the current Y coordinate for the center of the map. This property is a Double representing the latitude.

Discussion

The CenterY property is set when a new Geoset is loaded.

See Also

Map.CenterX property

Map.ZoomTo method

214 MapX Reference

Page 229: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.ClipLine method (Map object)

Map.ClipLine method (Map object)

Purpose

This method accepts parameters representing the endpoints of an imaginary line on the map. If any portion of the line falls within the view rectangle, ClipLine will adjust the parameters so that none of the resulting line falls outside of the view rectangle.

Syntax

[ Boolean= ]OBJECT.ClipLine (X1, Y1, X2, Y2)

Remarks

All parameters are passed by reference and should be in the Map.NumericCoordSys coordinate system.

The return value of ClipLine is True if any portion of the line fell inside the view rectangle, and False otherwise.

If the line is completely within the Map window, none of the parameters will be affected and ClipLine will return True. If some section of the line is within the map window, the coordinates will be adjusted so that they form the portion of the line that is within the view window, and ClipLine will return True. If the line is completely outside the map window, the coordinates will not be affected and ClipLine will return False.

Part Description

OBJECT Represents a Map object.

X1 Double (by Reference). On input: Longitude coordinate of the first endpoint of the unclipped line. On output: longitude coordinate of the first endpoint of the clipped line.

Y1 Double (by Reference). On input: Latitude coordinate of the first endpoint of the unclipped line. On output: latitude coordinate of the first endpoint of the clipped line.

X2 Double (by Reference). On input: Longitude coordinate of the second endpoint of the unclipped line. On output: longitude coordinate of the second endpoint of the clipped line.

Y2 Double (by Reference). On input: Latitude coordinate of the second endpoint of the unclipped line. On output: Latitude coordinate of the second endpoint of the clipped line.

Mapx Referenc 215

Page 230: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.CliplineV method (Map object)

See Also

Map.ClipLineV method

Layers.AddUserDrawLayer method

DrawUserLayer event

Map.NumericCoordSys property

Map.CliplineV method (Map object)

Purpose

This method accepts parameters representing the endpoints of an imaginary line on the map. If any portion of the line falls within the view rectangle, ClipLineV will adjust the parameters so that none of the resulting line falls outside of the view rectangle. It is identical to the Map.ClipLine method, except that it has Variant parameters rather than Double parameters.

Syntax

[ Boolean= ] OBJECT.ClipLineV(X1, Y1, X2, Y2)

All parameters are variants which are passed by reference. They are expected to contain numeric values and should be in the Map.NumericCoordSys coordinate system. An exception code 1111 is thrown if any of the parameters could not be converted to a number.

The return value of ClipLineV is True if any portion of the line fell inside the view rectangle, and False otherwise.

Part Description

OBJECT Represents a Map object.

X1 Variant (by Reference). On input: Longitude coordinate of the first endpoint of the unclipped line. On output: longitude coordinate of the first endpoint of the clipped line.

Y1 Variant (by Reference). On input: Latitude coordinate of the first endpoint of the unclipped line. On output: latitude coordinate of the first endpoint of the clipped line.

X2 Variant (by Reference). On input: Longitude coordinate of the second endpoint of the unclipped line. On output: longitude coordinate of the second endpoint of the clipped line.

Y2 Variant (by Reference). On input: Latitude coordinate of the second endpoint of the unclipped line. On output: Latitude coordinate of the second endpoint of the clipped line.

216 MapX Reference

Page 231: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.ConvertCoord method (Map object)

If the line is completely within the Map window, none of the parameters will be affected and ClipLineV will return True. If some section of the line is within the map window, the coordinates will be adjusted so that they form the portion of the line that is within the view window, and ClipLineV will return True. If the line is completely outside the map window, the coordinates will not be affected and ClipLineV will return False.

See Also

Map.ClipLine method

Map.NumericCoordSys method

Map.ConvertCoord method (Map object)

Purpose

Converts map coordinates to screen display coordinates or screen coordinates to map coordinates depending on the Dir parameter passed in the method. Screen coordinates are specified in pixels.

Syntax

OBJECT.ConvertCoord (ScreenX, ScreenY, MapX, MapY, Dir)

Either the Screen coordinates or the Map coordinates are provided, and the others are filled out based on the Dir specified.

Example in Visual Basic

`This sample shows how to use the Map.ConvertCoord method to

`convert from screen units (pixels) to Map X/Y

`coordinates in Degrees of Longitude/Latitude.

Private Sub Command1_Click()

Dim ScreenX As Single

Dim ScreenY As Single

Dim MapX As Double

Part Description

OBJECT Represents a Map object.

ScreenX Screen x coordinate in pixels. Single value.

ScreenY Screen y coordinate in pixels. Single value.

MapX Map x coordinate (longitude). Double value.

MapY Map y coordinate (latitude). Double value.

Dir Direction to convert coordinates, either from Map to Screen, or Screen to Map. This takes a ConversionConstants value.

Mapx Referenc 217

Page 232: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.ConvertCoord method (Map object)

Dim MapY As Double

`Get the center of the Map in screen coordinates:

ScreenX = Map1.MapScreenWidth / 2

ScreenY = Map1.MapScreenHeight / 2

`Convert the screen center to map coordinates

Map1.ConvertCoord ScreenX, ScreenY, MapX, MapY, miScreenToMap

`Display the converted coordinates and the map's centerX/Y

`properties: Note that these numbers may not be exactly

`the same due to rounding.

Debug.Print "Converted Center: " & MapX & ", " & MapY

Debug.Print " Map Center: " & Map1.CenterX & ", " & _

Map1.CenterY

End Sub

Example in C++

void CSampleProjectView::ConvertCenter() {

float ScreenX,ScreenY;

double MapX,MapY;

CString message;

try {

// Get the center of the Map in screen coordinates

ScreenX = (float)m_Map.GetMapScreenWidth() / 2;

ScreenY = (float)m_Map.GetMapScreenHeight() / 2;

// Convert the screen center to map coordinates

m_Map.ConvertCoord(&ScreenX,&ScreenY,&MapX,&MapY,miScreenToMap);

// Display the converted coordinates and the map's centerX/Y

// properties: not that these numbers may not be exactly

// the same due to rounding.

message.Format("Converted Center: %f, %f\n Map Center:%f, %f",MapX,MapY,m_Map.GetCenterX(),m_Map.GetCenterY());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {e->ReportError();e->Delete();

}}

218 MapX Reference

Page 233: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.ConvertCoordV method (Map object)

Map.ConvertCoordV metho (Map object)

Purpose

Converts map coordinates to screen display coordinates or screen coordinates to map coordinates depending on the Dir parameter passed in the method. Variant version of ConvertCoord method. Screen coordinates are specified in pixels.

Syntax

OBJECT.ConvertCoordV (ScreenX, ScreenY, MapX, MapY, Dir)

Either the Screen coordinates or the Map coordinates are provided, and the others are filled out based on the Dir specified.

Example in Visual Basic

`This sample shows how to use the Map.ConvertCoordV method to

`convert from screen units (pixels) to Map X/Y

`coordinates in Degrees of Longitude/Latitude.

Private Sub Command1_Click()

Dim ScreenX As Variant

Dim ScreenY As Variant

Dim MapX As Variant

Dim MapY As Variant

`Get the center of the Map in screen coordinates:

ScreenX = Map1.MapScreenWidth / 2

ScreenY = Map1.MapScreenHeight / 2

`Convert the screen center to map coordinates

Map1.ConvertCoordV ScreenX, ScreenY, MapX, MapY, miScreenToMap

`Display the converted coordinates and the map's centerX/Y

`properties: Note that these numbers may not be exactly the

`same due to rounding.

Part Description

OBJECT Represents a Map object.

ScreenX Screen x coordinate in pixels. Variant value.

ScreenY Screen y coordinate in pixels. Variant value.

MapX Map x coordinate (longitude). Variant value.

MapY Map y coordinate (latitude). Variant value.

Dir Direction to convert coordinates, either from Map to Screen, or Screen to Map. This takes a ConversionConstants value.

Mapx Referenc 219

Page 234: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.ConvertCoordV method (Map object)

Debug.Print "Converted Center: " & MapX & ", " & MApY

Debug.Print " Map Center: " & Map1.CenterX & ", " & _

Map1.CenterY

End Sub

Example in C++

void CSampleProjectView::ConvertCenterV() {

float ScreenX,ScreenY;

double MapX,MapY;

CString message;

try {

// Get the center of the Map in screen coordinates

ScreenX = (float)m_Map.GetMapScreenWidth() / 2;

ScreenY = (float)m_Map.GetMapScreenHeight() / 2;

COleVariant ScreenXVar(ScreenX),ScreenYVar(ScreenY),MapXVar(MapX), MapYVar(MapY);

// Convert the screen center to map coordinates

m_Map.ConvertCoordV(&ScreenXVar,&ScreenYVar,& MapXVar,&MapYVar,miScreenToMap);

// Display the converted coordinates and the map's centerX/Y

// properties: not that these numbers may not be exactly

// the same due to rounding.

message.Format("Converted Center: %f, %f\n Map Center: %f, %f", MapXVar.fltVal,MapYVar.fltVal,m_Map.GetCenterX(),m_Map.GetCenterY());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

220 MapX Reference

Page 235: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.CreateCustomTool method (Map object)

Map.CreateCustomTool method (Map object)

Purpose

Creates a custom tool, that when used, sends a ToolUsed event.

Note: If you create a Custom Tool of type circle and in theTool_Used event of the MapX control do a SelectByRadius with the values passed into the event, the results are not the same as if you select objects with the Radius Select Tool. The SelectByRadius method will not select exactly what is under the circle drawn on the Control when the custom tool is being used because this circle is an approximation that does not consider the projection of the map. Selections made with the actual Radius Select Tool correspond exactly to what is under the circle.

Syntax

OBJECT.CreateCustomTool (ToolNumber, Type, Cursor, [ShiftCursor] , [CtrlCursor], [InfoTips])

Remarks

Custom tools can be created to build tools that perform specialized behavior. For example, a tool could be built to have the behavior of displaying information about the object that was clicked on. Here, we would define a tool of type miToolTypePoint, and in the ToolUsed event handler, write code to display information about the object that falls under the point that was clicked on (using Layer.SelectByPoint).

Part Description

OBJECT Represents a Map object.

ToolNumber Number of the tool used to reference it later. This value can be an integer between 1 and 999.

Type The type describes the tool behavior. This takes a ToolTypeConstants value.

Cursor Cursor shape when the tool created is the CurrentTool and the cursor is over the map. This takes a CursorConstants value.

ShiftCursor Variant: A CursorConstants value, indicating the cursor that should appear while the SHIFT key is held down. Optional. If omitted, the SHIFT key has no effect on the cursor.

CtrlCursor Variant: A CursorConstants value, indicating the cursor that should appear while the CTRL key is held down. Optional. If omitted, the CTRL key has no effect on the cursor.

InfoTips Boolean: Set to true if you want to show InfoTips. Default value is false.

Mapx Referenc 221

Page 236: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.CreateCustomTool method (Map object)

Example in Visual Basic

Private Sub Command1_Click()

Map1.CurrentTool = 99

End Sub

Private Sub Command2_Click()

Map1.CurrentTool = miZoomInTool

End Sub

Private Sub Form_Load()

Map1.CreateCustomTool 99, miToolType, miCrossCursor

End Sub

Private Sub Map1_ToolUsed(ByVal ToolNum As Integer, _

ByVal X1 As Double, ByVal Y1 As Double, _

ByVal X2 As Double, ByVal Y2 As Double, _

ByVal Distance As Double, ByVal Shift As Boolean, _

ByVal Ctrl As Boolean, EnableDefault As Boolean)

Select Case ToolNum

Case 99

Debug.Print "Our custom tool was used at these coordinates:

Debug.Print " (" & X1 & "," & Y1 & ") - (" & X2 & "," & Y2 _

& ")"

Case miZoomInTool

Debug.Print "I will disallow the use of the ZoomIn tool."

EnableDefault = False

Case Else

Debug.Print "Another tool was used: " & ToolNum

End Select

If Ctrl Then Debug.Print " The Control Key was pressed"

If Shift Then Debug.Print " The Shift Key was pressed"

End Sub

Example in C++

void CSampleProjectView::OnZoomInToolSelect() {

try {

m_Map.SetCurrentTool(miZoomInTool);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

222 MapX Reference

Page 237: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.CreateCustomTool method (Map object)

e->Delete();

}

}

void CSampleProjectView::OnCustomToolSelect() {

try {

m_Map.SetCurrentTool(99);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

void CSampleProjectView::CreateTool() {

try {

m_Map.CreateCustomTool(99,miToolTypeLine,miCrossCursor);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

void CSampleProjectView::OnToolUsed(short ToolNum, double X1, double Y1, double X2, double Y2, double Distance, BOOL Shift, BOOL Ctrl, BOOL* EnableDefault) {

CString msg;

switch(ToolNum) {

case 99:

msg.Format("Our custom tool was used at these coordinates: \n (%d, %d) - (%d, %d)\n",X1,Y1,X2,Y2);

break;

case miZoomInTool:

msg = "I will disallow the use of the ZoomIn tool\n";

*EnableDefault = FALSE;

break;

Mapx Referenc 223

Page 238: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.CurrentTool property (Map object)

default:

msg.Format("Another tool was used: %d\n",ToolNum);

};

if(Ctrl)

msg += "The Control Key was pressed\n";

if(Shift)

msg += "The Shift Key was pressed\n";

AfxMessageBox(msg);

}

)

See Also

Map.CurrentTool property

ToolUsed Event

Map.CurrentTool property (Map object)

Purpose

Sets the current tool. This takes a ToolConstants value. The default is miArrowTool.

Remarks

Different tools will cause the mouse to perform a variety of different tasks. For example, if the current tool is set to miLabelTool, when you click the mouse, it will place a label on that particular map object. The mouse cursor will change based on the tool you are using.

If you have defined a custom tool, set it to the CurrentTool by specifying its ToolNumber.

Example

`Make the select tool active:

Map1.CurrentTool = miSelectTool

See Also

Map.CreateCustomTool method

ToolUsed Event

224 MapX Reference

Page 239: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.DataSet property (Map object)

Map.DataSet property (Map object)

Purpose

Specifies a DataSet to add. This only works at Design time - not at Run time. This property is for use in Microsoft Visual Basic only

Remarks

Visual Basic will display a list of all of the Data Controls on the current form in the Visual Basic property sheet for MapX. Choosing one of the Data Controls in the list for the DataSet property will cause MapX to create a DataSet for it at Run time with the data defined by the DataControl.

This is similar to DataSets.Add method. However, since this takes no parameters, it assumes default behavior for the rest of the parameters. The GeoField parameter can be specified using the Map.DataSetGeoField property. You can also choose which fields (columns) and aggregation methods to use for each field on the MapX `Data' property page.

See Also

DataSets.Add method,

Map.DataSetGeoField property

Map.DataSetGeoField property (Map object)

Purpose

Specifies which field of the DataSet specified in the Map.DataSet property contains the geographic information. This is a String specifying the field name.

Remarks

This is similar to the GeoField parameter of the DataSets.Add method, but specifying the GeoField for the DataSet specified at Design time.

See Also

Map.DataSet property

DataSets.Add method

Mapx Referenc 225

Page 240: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.DataSets property (Map object)

Map.DataSets property (Map object)

Purpose

The Datasets collection for the map.

See Also

DataSet object and collection

Map.DataSetTheme property (Map object)

Purpose

Specifies the theme type for the dataset specified by the Map.DataSet property. This takes a ThemeTypeConstants value. This defaults to miAutoThemeType.

Discussion

If you are specifying a DataSet at Design time (Map.DataSet property), then you can have that data thematically mapped. This controls the theme style. This is similar to the Themes.Add method, but is available at Design time. You can choose which field or fields to base your theme on in the MapX Theme tab of the property page.

The DataSetTheme property is ignored if the DataSet property is not set.

See Also

Themes.Add method

Map.DataSet property

Map.DefaultConversionResolution property (Map object)

Purpose

A read/write system setting that controls the resolution (i.e. the number of nodes) used when converting special MapInfo feature types, such as arcs, into regions or polylines, or when generating circles, ellipses, arcs or buffers. It is an integer which can take on any value up to 32,763.

226 MapX Reference

Page 241: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.DefaultStyle property (Map object)

Remarks

Various methods (listed below) allow you to explicitly specify an optional resolution parameter. If you do not specify a resolution value, MapX uses the resolution setting specified by the DefaultConversionResolution property

This property affects the generation of buffers, circles, ellipses, and arcs. When generating these types of features, you can control the resolution (sometimes called the "smoothness") of the features. For example, the following table shows two different circular regions-one containing 10 nodes, and the other containing 30 nodes.

Circular region with 10 nodes Circular region with 30 nodes

Increasing the resolution produces a smoother looking region; however, such regions take longer to generate, and the resulting object requires more storage space.

This property also controls the resolution used when a MapInfo table contains an arc, circle, rectangle, or rounded rectangle feature, and MapX converts the feature into a region or polyline. See Automatic Conversion of Special Features.

See Also

FeatureFactory.BufferFeatures method

FeatureFactory.CreateArc method

FeatureFactory.CreateCircularRegion method

FeatureFactory.CreateEllipticalRegion method

Layer.SearchWithinDistance method

Map.DefaultStyle property (Map object)

Purpose

This is a Style object that has the style for both symbol and text objects when they are created by using the Annotation.AddSymbol or Annotation.AddText methods.

Discussion

The default symbol is a 12 point gray star. The default text style is 10 point Arial.

Mapx Referenc 227

Page 242: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.DisplayCoordSys property (Map object)

Example in Visual Basic

Private Sub Command1_Click()

With Map1.DefaultStyle

.SymbolCharacter = 36

.SymbolFontColor = RGB(255, 0, 0)

.SymbolFont.Size = 24

End With

End Sub

Example in C++

void CSampleProjectView::SetDefaultStyle() {

CY fontSize;

fontSize.int64 = 24;

try {

m_Map.GetDefaultStyle().SetSymbolCharacter(36);

m_Map.GetDefaultStyle().SetSymbolFontColor(255);

m_Map.GetDefaultStyle().GetSymbolFont().SetSize(fontSize);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

See Also

Style object

Map.DisplayCoordSys property (Map object)

Purpose

Returns a read-write CoordSys object (coordinate system) that controls how the map is displayed.

228 MapX Reference

Page 243: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.Distance method (Map object)

Remarks

The DisplayCoordSys represents the coordinate system (or "projection") in which the map is displayed. By default, the map's coordinate system is set by the geoset. By modifying the map's DisplayCoordSys (through the CoordSys.Set method), you can display the map in another coordinate system.

The DisplayCoordSys property only affects the appearance of the map. To access the coordinate system used to interpret or return map coordinates, use the NumericCoordSys property

Map.Distance method (Map object)

Purpose

Computes the distance between two specified points on the map. The distance is returned as a Double, in the units specified by the MapUnit property

Syntax

[ distance = ]OBJECT.Distance( x1,y1,x2,y2 )

Remarks

The distance is calculated using the Great Circle Calculation.

Example in Visual Basic

Private Sub Command1_Click()

Dim earthCircumference As Double

Map1.MapUnit = miUnitMile

earthCircumference = 2 * Map1.Distance(0, 0, 180, 0)

Debug.Print "Earth's Circumference: " & earthCircumference

End Sub

Private Sub Form_Load()

Map1.CurrentTool = miZoomInTool

End Sub

Part Description

OBJECT Represents a Map object.

x1 x coordinate of the first point (longitude). Double value.

y1 y coordinate of the first point (latitude). Double value.

x2 x coordinate of the second point (longitude). Double value.

y2 y coordinate of the second point (latitude). Double value

Mapx Referenc 229

Page 244: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.ExportMap method (Map object)

Example in C++

void CSampleProjectView::EarthDistance() {

double earthCircumference;

CString msg;

try {

m_Map.SetMapUnit(miUnitMile);

earthCircumference = 2 * m_Map.Distance(0,0,180,0);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

msg.Format("Earth's Circumference: %d miles",earthCircumference);

AfxMessageBox(msg);

}

See Also

Map.MapUnit property

Map.ExportMap method (Map object)

Purpose

Exports the map window

MapX is capable of exporting to the following formats:JPG TIF GIFPNG WMF PSDBMP

230 MapX Reference

Page 245: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.ExportMap method (Map object)

Syntax

OBJECT.ExportMap (Location, Format, [Width], [He])

Remarks

If features on the map are selected, you might not want to output the selection highlighting; see Map.ExportSelection property

Example in Visual Basic

`This sample demonstrates the Map.ExportMap method. It uses

`the method to place a map in the clipboard as a BMP.

Private Sub Command1_Click()

Map1.PaperUnit = miUnitCentimeter

`Export a 12 cm by 9 cm map to the clipboard in BMP Format

Map1.ExportMap "clipboard", miFormatBMP, 12, 9

If Clipboard.GetFormat(vbCFBitmap) Then

Debug.Print "Clipboard contains a BMP"

Else

Debug.Print "Clipboard does not contain a BMP"

End If

End Sub

Part Description

OBJECT Represents a Map object.

Location File specification of place to put the output. If the keyword 'CLIPBOARD' is used, the image is put on the clipboard.

Format Output format. This takes an ExportFormatConstants value.

Width Width of output. This is a double value, and specifies width in terms of Paper Units (Map.PaperUnit). This is an optional parameter, and if not specified, Map.MapPaperWidth is used.

Height Height of output. This is a double value, and specifies height in terms of Paper Units (Map.PaperUnit). This is an optional parameter, and if not specified, Map.MapPaperHeight is used.

Mapx Referenc 231

Page 246: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.ExportSelection property (Map object)

Example in C++

void CSampleProjectView::ExportMapToClipboardAsBMP() {

try {

m_Map.SetPaperUnit(miUnitCentimeter);

// Export a 12 cm by 9 c, map to the clipboard in BMP format

m_Map.ExportMap("clipboard",miFormatBMP,12.0,9.0);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

See Also

Map.ExportSelection property

Map.PaperUnit property

Map.ExportSelection property (Map object)

Purpose

Returns or sets a boolean property, controlling whether the selection's highlighting is included in output.

If set to True, output produced by the ExportMap method or the PrintMap method will include any current selection highlighting. If set to False, output will not include the highlighting.

Example

'export a jpg image for display in a browser, and

'include the selection highlighting in the image

Map1.ExportSelection=True

Map1.ExportMap "c:\temp\map.jpg", miFormatJPEG

See Also

To control the style in which the selection highlighting is drawn, set the Map.SelectionStyle property

232 MapX Reference

Page 247: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.FeatureFactory property (Map object)

Map.FeatureFactory property (Map object)

Purpose

Returns a FeatureFactory object, which supports various methods for creating and modifying features on the map.

Remarks

This property returns a FeatureFactory object, which has methods that support various editing tasks-creating features, generating buffer regions, combining features, and testing for intersections between features.

Map.GeoDictionary property (Map object)

Purpose

This property specifies the location of a registry entry which is used to determine the GeoDictionary file and the default data directory. This is a String value, and can only be set at design time.

Remarks

When a map control is created, MapX will query the registry key: HKEY_LOCAL_MACHINE\Software\MapInfo\MapX\4.0\<Value of GeoDictonary Property>

The value of this registry key specifies two things:• The GeoDictionary file, which maintains information about which map layers can

be matched to which information. (MapX can be used without a GeoDictionary.)• The default data directory. This directory is searched for GeoSet files (*.gst) which

are shown in the Property Pages and the Map.GeoSets collection.

There are three valid options for the registry value:• Could contain a full file spec for the Geodictionary file (e.g. "C:\Program

Files\MapInfo MapX\Maps\geodict.dct"). The data directory is set to be the path leading to the Geodictionary file named by this key (in this example, "C:\Program Files\MapInfo MapX\Maps\". The in-memory geodictionary is initialized from the Geodictionary file and layers contained in the Geodictionary can be automatically matched against it too. Layers added to the map are added to the in-memory geodictionary so they can be auto matched against.

• Could contain just a path specification (e.g. "C:\Program Files\MapInfMapX\Maps\"). The data directory is set to this directory. The in-memory geodictionary is initialized empty. Layers added to the map are still added to the in-memory geodictionary so they can be auto matched against .

• Could be empty. The in-memory geodictionary is initialized empty. Layers added to the map are still added to the in-memory geodictionary so they may be auto matched.

The default value of Map.GeoDictionary is "GeoDictionary", meaning that MapX will query the registry entry HKEY_LOCAL_MACHINE\Software\MapInfo\MapX\4.0\GeoDictionary.

Mapx Referenc 233

Page 248: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.GeoSet property (Map object)

See Also

Map.GeoSet property

Map.GeoSet property (Map object)

Purpose

This read/write property sets the GeoSet. It retuns a String Value. To set this property, the filespec (entire path) or the `friendly name' (the name a geoset) of the GeoSet is used.

Remarks

A GeoSet is a collection of map layers and their settings. A GeoSet can be specified at Design time. If this is set during Run time, it will first remove all loaded layers and datasets, then load the new GeoSet. To simply remove all loaded layers and datasets and not load a new geoset, specify an empty string. The default GeoSet that is loaded is US.GST.

Example in C++

// Map.GeoSet Property

void CSampleProjectView::CanadaMap() {

try {

// Close the existing set of map layers and load the Canada map

TRACE0("Old Geoset: " + m_Map.GetGeoSet());

m_Map.SetGeoSet("Canada.gst");

TRACE0("New Geoset: " + m_Map.GetGeoSet());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub CanadaMap()

' Close the existing set of map layers and load the Canada map

Debug.Print "Old Geoset: " & Map1.GeoSet

Map1.GeoSet = "Canada.gst"

Debug.Print "New Geoset: " & Map1.GeoSet

End Sub

234 MapX Reference

Page 249: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.GeoSets property (Map object)

See Also

Layers.AddGeoSetLayers method

Map.GeoSets property (Map object)

Purpose

This read-only property returns a collection of Geoset objects. This collection consists of all geosets in the Maps directory.

See Also

Geoset object and collection

Map.GeoSetWidth property (Map object)

Purpose

A read-only property representing the width of the GeoSet (maximum width of all Layers in the map). This is a Double value in units specified by the MapUnit property.

This property is useful when you need to set the zoom to the extents of the map.

Example in C++

// Map.GeoSetWidth Property

void CSampleProjectView::ViewGeoSetExtents() {

try {

// The Zoom of a Map is defined as the width of the map control in Map Units

// We can simply set the zoom to the GeoSet width to view the entire GeoSet

m_Map.SetZoom(m_Map.GetGeoSetWidth());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Mapx Referenc 235

Page 250: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.hWnd property (Map object)

Example in Visual Basic

Private Sub CmdViewGeoSetExtents_Click()

' The Zoom of a Map is defined as the width of the map

' control in Map Units

' We can simply set the zoom to the GeoSet width to view

' the entire GeoSet

Map1.Zoom = Map1.GeoSetWidth

End Sub

Map.hWnd property (Map object)

Purpose

The handle to the window of the MapX control. Only valid at Run time. This is a read-only property

Map.InfotipSupport property (Map object)

Purpose

This property allows the programmer to control whether or not MapX displays pop-up InfoTips. It is a Boolean property, and defaults to True.

Remarks

When InfoTipSupport is True, InfoTips will pop up for the following tools: Arrow Tool, Select Tool, Label Tool, and any custom tools where the ShowInfoTips parameter to Map.CreateCustomTool was True.

See Also

Map.InfotipPopupDelay property

Map.CreateCustomTool method

Map.InfotipPopupDelay property (Map object)

Purpose

This property controls the duration of time the user needs to have the mouse pointer over an object before an InfoTip is popped up. This property only applies when Map.InfotipSupport is True. It is an Integer value, specified in Milliseconds. The default is 500.

236 MapX Reference

Page 251: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.IsPointVisible method (Map object)

See Also

Map.InfotipSupport property

Map.IsPointVisible metho (Map object)

Purpose

Returns true or false whether the point (in map coordinates) is currently within the visible portion of the map window.

Syntax

[ bool= ] OBJECT.IsPointVisible (X, Y )

Map.Layers property (Map object)

Purpose

The Layers collection for the map.

See Also

Layer object and Layers collection

Map.MapUnit property (Map object)

Purpose

Sets the units used for distance calculations. Takes a MapUnitConstants value. The default unit is miUnitMile.

Part Description

OBJECT Represents a Map object.

X Map Coordinates for east/west position (latitude)

Y Map Coordinates for north/south position (longitude)

Mapx Referenc 237

Page 252: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.MapUnit property (Map object)

Example in C++

// Map.MapUnit Property

void CSampleProjectView::EarthCircumference() {

double CircKm,CircMi;

CString msg;

try {

// Save the old MapUnit so that we can change it back

MapUnitConstants oldUnit = m_Map.GetMapUnit();

// Get the Earth's circumference in Kilometers

m_Map.SetMapUnit(miUnitKilometer);

CircKm = 2.0 * m_Map.Distance(0,0,180,0);

// Get the Earth's circumference in Miles

m_Map.SetMapUnit(miUnitMile);

CircMi = 2.0 * m_Map.Distance(0,0,180,0);

msg.Format("The Earth has a circumference of %f miles (%f kilometers)",CircMi,CircKm);

AfxMessageBox(msg);

m_Map.SetMapUnit(oldUnit);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub EarthCircumference()

Dim CircKm as Double

Dim CircMi as Double

Dim oldUnit as MapUnitConstants

' Save the old MapUnit so that we can change it back

oldUnit = Map1.MapUnit

238 MapX Reference

Page 253: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.MapPaperHeight property (Map object)

' Get the Earth's circumference in Kilometers

Map1.MapUnit = miUnitKilometer

CircKm = Map1.Distance(0,0,180,0) * 2.0

' Get the Earth's circumference in Miles

Map1.MapUnit = miUnitMile

CircMi = Map1.Distance(0,0,180,0) * 2.0

Debug.Print "The Earth has a circumference of " & CircMi _

& " miles (" & CircKm & " kilometers)"

Map1.MapUnit = oldUnit

End Sub

See Also

MapUnitConstants

Map.MapPaperHeight property (Map object)

Purpose

The height of the map control. This is a Double value specified in terms of Paper Units (Map.PaperUnit.). It is a Read-only property.

Map.MapPaperWidth property (Map object)

Purpose

The width of the map control. This is a Double value specified in terms of Paper Units (Map.PaperUnit.). It is a Read-only property.

Map.MapScreenHeight property (Map object)

Purpose

The MapScreenHeight and MapScreenWidth properties make it easy to position legends. These properties contain the width and height of the map control, in pixels. Since legends also contain their width and height, in pixels, it is easy to position legends.

Mapx Referenc 239

Page 254: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.MapScreenWidth property (Map object)

Example in C++

// Map.MapScreenWidth Property

// Map.MapScreenHeight Property

void CSampleProjectView::PostitionLegend(CMapXLegend& LegendMove) {

try {

// Place the legend at the bottom left corner of the screen

LegendMove.SetTop(m_Map.GetMapScreenHeight()-LegendMove.GetHeight());

LegendMove.SetLeft(m_Map.GetMapScreenWidth()-LegendMove.GetWidth());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub btnMapScreenHeightWidth_Click()

Dim sHeight As Single

Dim sWidth As Single

sHeight = Map1.MapScreenHeight

sWidth = Map1.MapScreenWidth

End Sub

Map.MapScreenWidth property (Map object)

Purpose

The MapScreenHeight and MapScreenWidth properties make it easy to position legends. These properties contain the width and height of the map control, in pixels. Since legends also contain their width and height, in pixels, it is easy to position legends.

240 MapX Reference

Page 255: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.MatchNumericFields property (Map object)

Example

Private Sub btnMapScreenHeightWidth_Click()

Dim sHeight As Single

Dim sWidth As Single

sHeight = Map1.MapScreenHeight

sWidth = Map1.MapScreenWidth

Map.MatchNumericFields property (Map object)

Purpose

This property controls matching on numeric fields. This property appears on the Data (design time) property page. If MatchNumericFields is true, then numeric fields are considered candidate keys (along with the alphanumeric fields) when MapX is auto matching. If it is false, then numeric columns are not considered when doing auto matching. By default this property is false.

If you specify a numeric GeoField in Datasets.Add, MapX will use it whether or not MatchNumericFields is TRUE.

Map.MatchThreshhold property (Map Object)

Purpose

This is the minimum threshhold perctange required for matching a map layer with a data source.

The default = 80.

Map.MaxSearchTime property (Map object)

Purpose

Sets the search time for automatic GeoColumn detection and the automatic GeoSet detection when bringing in data using DataSets.Add. This is an Integer value specifying time in Seconds. The default time is 5 seconds.

Map.MouseIcon property (Map object)

Purpose

If you need to specify a customized cursor for the mouse icon with the Map.MousePointer property, use the Map.MouseIcon property. The Map.MouseIcon property lets the programer specify a custom cursor to use as the default mouse cursor in MapX.

Mapx Referenc 241

Page 256: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.MousePointer property (Map object)

Example in Visual Basic

Map1.MousePointer = miCustomCursor

Map1.MouseIcon = "c:\windows\cursors\globe.ani"

Remarks

A string which specifies the name of the file or the custom mouse cursor. The name must specify a .cur or .ani file type. If the specified cursor can not be loaded, an exception is thrown.

See Also

Map.MousePointer property

Map.MousePointer property (Map object)

Purpose

Sets the shape of the mouse cursor. This takes a CursorConstants value. The default is miDefaultCursor, which means that the cursor of the current tool will be used.

Example in C++

// Map.MousePointer Property

void CSampleProjectView::DatasetAdd() {

try {

m_Map.SetMousePointer(miHourglassCursor);

AddMyODBCDataset(); // Embark on a lengthy operation...

m_Map.SetMousePointer(miDefaultCursor);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub DatasetAdd_Click()

Map1.MousePointer = miHourglassCursor

' Embark on a lengthy operation...

AddMyODBCDataset

Map1.MousePointer = miDefaultCursor

End Sub

242 MapX Reference

Page 257: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.MouseWheelSupport property (Map object)

Map.MouseWheelSupport property (Map object)

Purpose

Controls the level of Intellimouse support: None, Zoom/Scroll only (no Autscroll), or Full. This property is set with a MouseWheelSupportConstants.

See Also

MouseWheelSupportConstants

Map.NumericCoordSys property (Map object

Purpose

Returns a read-write CoordSys object (coordinate system) that controls how MapX interprets numeric map coordinates.

Remarks

The NumericCoordSys represents the coordinate system used to process numeric map coordinates. The default coordinate system is Longitude/Latitude WGS-84. By modifying the map's NumericCoordSys (through its CoordSys.Set method), you can work with map coordinates in another coordinate system.

The NumericCoordSys property does not affect the appearance of the map. To set the coordinate system (or "projection") in which the map is displayed, use the DisplayCoordSys property

Map.Pan method (Map object)

Purpose

This method will pan the map by the given offset in screen coordinates. (pixels)

Syntax

OBJECT Pan (ScreenX, ScreenY)

Parts Description

OBJECT Represents a Map object

ScreenX The amount to offset the horizontal screen coordinate.

ScreenY The amount to offset the vertical screen coordinate.

Mapx Referenc 243

Page 258: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.PanAnimationLayer (Map object)

Map.PanAnimationLayer (Map object)

Purpose

This property controls whether the animation layer (if there is one) is drawn into the backing store when the pan tool is in use so that the contents of the layer are dragged around with the rest of the map. The default is FALSE.

Example

' Set up the pan tool so that the animation layer is seen when the user pans the map

Map1.PanAnimationLayer = TRUE

Map1.CurrentTool = miPanTool

Map.PaperUnit property (Map object)

Purpose

Sets the unit of measure MapX will use for the map on paper. Specify the unit of measure by using the PaperUnits constant. The default is miUnitInch.

Map.PreferCompactLegends property (Map object)

Purpose

Sets whether or not to display a compact legend. This takes a Boolean value. The default value is false.

Remarks

When legends are created, they can be compact or full sized. When a thematic map is created, a legend is always shown. This setting controls how the legend will be shown. The legend can always be changed later using the Theme.Legend.Compact or Theme.Legend.Visible settings, but the initial setting controls the position of the legend.

Example in Visual Basic

Private Sub Form_Load()

Dim db As Database

Dim rs As Recordset

Dim ds As Dataset

Map1.PreferCompactLegends = True

Set db = DBEngine.Workspaces(0).OpenDatabase( _

"C:\Program Files\MapInfo MapX\Data\mapstats.mdb")

Set rs = db.OpenRecordset("USA")

244 MapX Reference

Page 259: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.PrintMap method (Map object)

Set ds = Map1.Datasets.Add(miDataSetDAO, rs, , , ,"USA")

ds.Themes.Add

End Sub

Example in C++

void CSampleProjectView::AddTheme(CDaoRecordset& SourceRecordset) {

CMapXDataset ds;

COleVariant Recordset;

COptionalVariant optVt;

Recordset.vt = VT_DISPATCH;

Recordset.pdispVal = SourceRecordset.m_pDAORecordset;

try {

m_Map.SetPreferCompactLegends(TRUE);

ds = m_Map.GetDatasets().Add(miDataSetDAO,Recordset,optVt,optVt,optVt,"USA");

ds.GetThemes().Add();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Map.PrintMap metho (Map object)

Purpose

Prints the map in the specified rectangle to the specified device context.

Mapx Referenc 245

Page 260: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.PrintMap method (Map object)

Syntax

OBJECT.PrintMap (hDC x, y, w, h)

Remarks

The current map is drawn to fit the rectangle given. Best results are obtained when the aspect ratio of width to height is maintained.

If features on the map are selected, you might not want to output the selection highlighting; see Map.ExportSelection property

Example in Visual Basic

Private Sub Command4_Click()

On Error GoTo ErrorHandler ` Set up error handler.

` coords must be in himetric

` print same size as on screen, in upper left of page

ScaleMode = 6 `set mode to mm

` there is no Printer.StartDoc method, it seems it is done

` implicitly when you use one of the printer.print methods

` so we need to print something before we print our map

` to start the page

Printer.CurrentX = 0

Printer.CurrentY = 0

Printer.Print " "

Map1.PrintMap Printer.hDC, 0, 0, Map1.Width * 100, _

Map1.Height * 100

Printer.NewPage ` Send new page.

Printer.EndDoc ` Printing is finished.

Exit Sub

Example in C++

// Map.PaperUnit Property

Part Description

OBJECT Represents a Map object.

hDC Printer device context. Can be any device context.

x Upper left corner X in HIMETRIC units.

y Upper left corner Y in HIMETRIC units.

w Width in HIMETRIC units.

h Height in HIMETRIC units.

246 MapX Reference

Page 261: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.PropertyPage method (Map object)

// Map.PrintMap Method

void CSampleProjectView::OnPrintMap(CDC* pDC,CPrintInfo* pInfo) {

try {

// get paper width in mm and convert to HIMETRIC (100th of a mm)

m_Map.SetPaperUnit(miUnitMillimeter);

double pw = m_Map.GetMapPaperWidth() * 100;

double ph = m_Map.GetMapPaperHeight()* 100;

m_Map.PrintMap((long)pDC->m_hDC,

pInfo->m_rectDraw.left,pInfo->m_rectDraw.

top,(long)pw,(long)ph);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Map.PropertyPage method (Map object)

Purpose

The PropertyPage method allows the user to control or set various properties of the map object at run-time. This is the same property page that is available in design mode, although, some properties cannot be set at run-time using this method.

Syntax

OBJECT.PropertyPage

Map.RedrawInterval property (Map object)

Purpose

This property enables incremental drawing. It is the time, in 1/100ths of a second, between when the display is updated with the off-screen bitmap. The minimum value is 10. A very high value (e.g., 3000) effectively turns off incremental drawing -- the screen won't be updated until the map is completely drawn off screen.

Mapx Referenc 247

Page 262: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.Refresh method (Map object)

Remarks

Currently, the map is drawn to an off-screen bitmap, then transferred to the screen when the bitmap is complete. Now, you can transfer to the screen more often to show the user that something is indeed happening. (This is especially useful when drawing streets at 25 mile zoom.)

Map.Refresh method (Map object)

Purpose

Forces the map to get redrawn immediately.

Syntax

OBJECT.Refresh

Remarks

Normally when an action is taken that causes the Map to be redrawn, MapX won't actually redraw until it receives a paint message, so that it can combine multiple redraws into one. This method causes MapX to redraw immediately, without waiting for the next paint message. This method will not return until the redraw is complete.

Example in Visual Basic

Map1.BackColor = miColorYellow

Map1.Refresh

Example in C++

void CSampleProjectView::Recolor() {

try {

m_Map.SetBackColor(miColorYellow);

m_Map.Refresh();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

See Also

Map.AutoRedraw property

248 MapX Reference

Page 263: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.Rotation property (Map object)

Map.Rotation property (Map object)

Purpose

Sets the rotation of the map. Rotation values are specified in degrees, increasing clockwise, with 0 indicating an unrotated map. Applying a rotation to a map does not change its zoom level or center point.

Note: A map containing one or more raster layers cannot be rotated, because MapX is unable to rotate raster images.

Map.SaveMapAsGeoset metho (Map object)

Purpose

Creates a geoset file representing the current status of the map (layer information, labeling settings, etc.).

Syntax

OBJECT SaveMapAsGeoset (name, filespec)

Remarks

If the map contains any temporary layers, those layers are left out of the new geoset file and an exception is thrown (after the geoset has been otherwise completely saved) to indicate such. This method also throws an exception if there are no layers in the map.

Example

Map1.SaveMapAsGeoset "My latest map", "C:\Data\Most Recent.GST"

Part Description

OBJECT A Map object.

name String that represents the geoset's ”friendly” name (the description that appears in the Geodictionary). If you specify an empty string, the map's Title is used.

filespec String that represents a full file path for the geoset file. If no path is specified, the new file is placed in the data directory. If no extension is specified, the standard .gst extension is used. If the specified file already exists, it is overwritten.

Mapx Referenc 249

Page 264: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.SearchPath property (Map object)

Map.SearchPath property (Map object)

Purpose

This property allows the user to set the SearchPath dynamically. A SearchPath is a "plotted course" via the drive and directory(ies) to where information "lives". The SearchPath is initially read from the registry. This property is available at run-time only.

Example in Visual Basic

Private Sub btnSearchPath_Click()

Dim str As String

' Get the default search path from the registry

str = Map1.SearchPath

' Update the search path

Map1.SearchPath = "d:\junk"

End Sub

Example in C++

void CSampleProjectView::SetSearchPath() {

CString oldPath,msg;

try {

// Get the default search path

oldPath = m_Map.GetSearchPath();

// Update the search path

m_Map.SetSearchPath("d:\\junk");

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

msg.Format("Changed the search path from \n\"%s\"\n to \"d:\\junk\"",oldPath);

AfxMessageBox(msg);

}

250 MapX Reference

Page 265: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.SelectionStyle property (Map object)

Map.SelectionStyle property (Map object)

Purpose

Returns or sets a Style object, representing the style in which selected features are drawn.

Remarks

This property returns a read/write Style object that controls the appearance of selected features in all layers.

To control the appearance of selected regions, set this Style object's RegionXXX properties, such as RegionColor. The RegionColor and RegionBorderXXX properties are used to draw the box around selected symbol features. The LineXXX properties are used to draw selected line features. Note that the SymbolXXX and TextXXX properties do not apply and have no effect.

Example

'Change color of all selected features to blue

Map1.SelectionStyle.RegionColor = miColorBlu

Map1.SelectionStyle.LineColor = miColorBlue

See Also

To omit the selection highlighting from output, set the Map.ExportSelection property to False.

Map.SetSize metho (Map object)

Purpose

Sets the size of the control, in pixels.

Syntax

OBJECT.SetSize (W, H)

Remarks

In most Visual Basic applications, you can resize the control without using the SetSize method -- just use the standard Width and Height properties supported by Visual Basic. The SetSize method can not be used with a map object on a form. SetSize is for users that create map objects via CreateObject() call.

Part Description

OBJECT Represents a Map object.

W The desired width of the control, in pixels.

H The desired height of the control, in pixels.

Mapx Referenc 251

Page 266: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.Title property (Map object)

Map.Title property (Map object)

Purpose

A Title object specifying the title for the map. This can be set to NULL for no title.

Use the Title object to control the title's text, display style, and position. Tip: If you want to set the title's text, and you do not care about its style or position, you can set the Map.TitleText property at design time.

Map.TitleText property (Map object)

Purpose

Returns or sets a string that appears as the map's title. If you specify an empty string, the title is hidden.

Remarks

The title defaults to the GeoSet name. If the TitleText is equal to the GeoSet name and the Geoset is changed, the TitleText also changes.

Example

Map1.TitleText = "Sales Forecast"

See Also

Map.Title property

Map.Version property (Map object)

Purpose

Specifies the version of MapX you are using. This is a String value, and is Read-only.

Map.WaitCursorEnabled property (Map object)

Pourpose

This property allows you to turn the Wait Cursor on or off manually. Default is True.

252 MapX Reference

Page 267: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.Zoom property (Map object)

Map.Zoom property (Map object)

Purpose

Contains or sets the current zoom value for the map. The zoom value is defined as the width across the map. This is a Double value in the units specified by the MapUnit property.

Example

Dim dZom as Double

dZoom = Map.Zoom 'Reads the map's current zoom.

- or -

Map.Zoom = dZoom ' Sets the map's current zoom to dZoom

Map.ZoomTo method (Map object)

Purpose

Zooms and centers the map.

Syntax

OBJECT.ZoomTo (Zoom, x, y)

Remarks

Use this method as a simple way to zoom and re-center the map. The alternative would be to set the Zoom, CenterX, and CenterY properties of the Map object, but doing it that way would cause 3 screen redraws unless screen updating was turned off, then on using the Map.AutoRedraw property

Example in Visual Basic

`This sample demonstrates the use of the Map.ZoomTo method

`It zooms in on New England on the US Map.

Private Sub Command1_Click()

Debug.Print "CenterX = " & Map1.CenterX

Debug.Print "CenterY = " & Map1.CenterY

Part Description

OBJECT Represents a Map object.

Zoom The zoom value. MapX defines the zoom value as the width across the control. This is a Double value specified in terms of Map Units (MapUnit).

X The x coordinate to center the map to. A Double value representing the longitude.

Y The y coordinate to center the map to. A Double value representing the latitude.

Mapx Referenc 253

Page 268: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Map.ZoomTo method (Map object)

Debug.Print " Zoom = " & Map1.Zoom

Map1.ZoomTo 800, -70.26, 44.05 `Zoom in on New England

Debug.Print "CenterX = " & Map1.CenterX

Debug.Print "CenterY = " & Map1.CenterY

Debug.Print " Zoom = " & Map1.Zoom

End Sub

Example in C++

void CSampleProjectView::Zoom() {

CString msg;

try {

msg.Format("CenterX = %lf\nCenterY = %lf\n Zoom = %lf",m_Map.GetCenterX(),m_Map.GetCenterY(),m_Map.GetZoom());

AfxMessageBox(msg);

m_Map.ZoomTo(800,-70.26,44.05); // Zoom in on New England

msg.Format("CenterX = %lf\nCenterY = %lf\n Zoom = %lf",m_Map.GetCenterX(),m_Map.GetCenterY(),m_Map.GetZoom());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

AfxMessageBox(msg);

}

254 MapX Reference

Page 269: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

MultivarCategory object and MultivarCategories collection

A pie or bar chart thematic map is exposed to OLE through the MultivarCategories collection, which is a collection of MultivarCategory objects. The collection contains one object for each bar in the bar chart, or one object for each wedge in the pie chart.

To obtain a MultivarCategories collection, reference the ThemeProperties.MultivarCategories property

Object Properties• MultivarCategory.Style property

Collection Properties• MultivarCategories.Count property• MultivarCategories.Item property

Example in C++

// MultivarCategories Object

void CSampleProjectView::ChangeChart(CMapXTheme& InTheme) {

try {

switch(InTheme.GetType()) {

case miThemeBarChart:

// No break statement: will fall through

case miThemePieChart:

// The theme is a multivariate theme

// If there is a pie or bar chart with two slices/bars, change the

// colors to Black and White

CMapXMultivarCategories MCategories;

MCategories = InTheme.GetThemeProperties().GetMultivarCategories();

if(MCategories.GetCount()==2) {

MCategories.Item(1).GetStyle().SetRegionColor(miColorBlack);

MCategories.Item(2).GetStyle().SetRegionColor(miColorWhite);

}

break;

case miThemeRanged:

Page 270: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

MultivarCategory object and MultivarCategories collection

// ...

break;

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub ChangeChart(InTheme as MapXLib.Theme)

Select Case InTheme.Type

Case miThemeBarChart, miThemePieChart

' The theme is a multivariate theme

' If there is a pie or bar chart with two slices/bars,

' change the

' colors to Black and White

If InTheme.ThemeProperties.MultivarCategories.Count = 2 Then

InTheme.ThemeProperties.MultivarCategories(1).Style. _

RegionColor = miColorBlack

InTheme.ThemeProperties.MultivarCategories(2). _

Style.RegionColor = miColorWhite

End If

Case miThemeRanged

' ...

End Select

End Sub

See Also

ThemeProperties.MultivarCategories property

LegendText object and LegendTexts collection

256 MapX Reference

Page 271: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

MultivarCategories.Count property (MultivarCategories collection)

MultivarCategories.Count property (MultivarCategories collection)

Purpose

Read-only integer value, indicating the number of variables used by the theme-the number of bars in a thematic bar chart, or the number of wedges in a thematic pie chart.

MultivarCategories.Item property (MultivarCategories collection)

Purpose

Returns one MultivarCategory object from the collection; this object describes the settings for one of the thematic variables (e.g. one of the bars in a bar chart theme).

MultivarCategory.Style property (MultivarCategory object)

Purpose

This property controls the style for objects that fall within this MultivarCategory. This is a Style object and may be set to an existing style object or you may set the style properties individually. The defaults are designed to provide highly contrasting styles.

See Also

Style object

Mapx Referenc 257

Page 272: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

MultivarCategory.Style property (MultivarCategory object)

258 MapX Reference

Page 273: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

NotesQueryInfo object

Perform queries on a Notes dataset by making a NotesQueryInfo object and using dataset type 8 (miDataSetNotesQuery).

This DataSet type will allow the MapX user to ask Notes to perform queries upon a database at run-time. To add a DataSet of this type to MapX, you will need to create a NotesQueryInfo object and pass it to DataSets.Add.

Object Properties• NotesQueryInfo.BeginDate property (NotesQueryInfo object)• NotesQueryInfo.Database property (NotesQueryInfo object)• NotesQueryInfo.DefaultNumericValue (NotesQueryInfo object)• NotesQueryInfo.DefaultStringValue property (NotesQueryInfo object)• NotesQueryInfo.EndDate property (NotesQueryInfo object)• NotesQueryInfo.FullTextSearch property (NotesQueryInfo object)• NotesQueryInfo.MaxNumDocs property (NotesQueryInfo object)• NotesQueryInfo.Query property (NotesQueryInfo object)• NotesQueryInfo.Server property (NotesQueryInfo object)

NotesQueryInfo.BeginDate property (NotesQueryInfo object)

Purpose

A string that defines a beginning cutoff date/time or a string that represents it (optional). Notes modified before this date/time are ignored during the search.

NotesQueryInfo.Database property (NotesQueryInfo object)

Purpose

This is either a name of a Notes database on a server, or a path to a local Notes database (.nsf).

Page 274: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

NotesQueryInfo.DefaultNumericValue property (NotesQueryInfo object)

NotesQueryInfo.DefaultNumericValue property (NotesQueryInfobject)

Purpose

Because a Notes Query can return documents that do not contain all of the fields specified, MapX will return a default numeric (double) if the requested numeric field is not found (optional). This value defaults to 0.

See Also

DataSets.Add

NotesQueryInfo.DefaultStringValue property (NotesQueryInfo object)

Purpose

Because a Notes Query can return documents that do not contain all of the fields specified, MapX will return a default string if the requested string field is not found (optional). This value defaults to "".

NotesQueryInfo.EndDate property (NotesQueryInfo object)

Purpose

A string that defines a end cutoff date/time or a string that represents it (optional). Notes modified before this date/time are ignored during the search.

NotesQueryInfo.FullTextSearch property (NotesQueryInfo object)

Purpose

This is a boolean value (TRUE or FALSE) that indicates both that the database will have a full text index and that the Query property is a full-text search query.

See Also

NotesQueryInfo.Query property

260 MapX Reference

Page 275: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

NotesQueryInfo.MaxNumDocs property (NotesQueryInfo object)

NotesQueryInfo.MaxNumDocs property (NotesQueryInfo object)

Purpose

An integer which specifies the maximum number of Notes to be allowed in the results (optional). If the input is zero, all notes that match the search criteria will collected.

NotesQueryInfo.Query property (NotesQueryInfo object)

Purpose

If the FullTextSearch property is set to TRUE, this property is a full-text search query string. If the FullTextSearch property is FALSE, this property become a Notes search formula. See your Notes database for information on how to form full-text search query or formula strings.

See Also

NotesQueryInfo.FullTextSearch property

NotesQueryInfo.Server property (NotesQueryInfo object)

Purpose

This is a string that defines which Notes server that the above database is on. This string is left empty if the Database property refers to a local database.

See Also

NotesQueryInfo.Database property

Mapx Referenc 261

Page 276: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

NotesQueryInfo.Server property (NotesQueryInfo object)

262 MapX Reference

Page 277: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

NotesViewInfo object

The NotesViewInfo object is required for the second parameter to Datasets.Add for datasets of type miDataSetNotesView. This DataSet type will access a specified view of a Database.

Object Properties• NotesViewInfo.Database property (NotesViewInfo object)• NotesViewInfo.Server (NotesViewInfo object)• NotesViewInfo.View (NotesViewInfo object)

See Also

DataSets.Add method

NotesViewInfo.Database property (NotesViewInfo object)

Purpose

This read/write property is either a name of a Notes database on a server, or a path to a local Notes database (.nsf).

NotesViewInfo.Server (NotesViewInfo object)

Purpose

This read/write property is a string that defines which Notes server that the above database is on. This string is left empty if the Database propertiy refers to a local database.

NotesViewInfo.View (NotesViewInfo object)

Purpose

This read/write property is a string that refers to the specific view within the database that the data will be pulled from.

Page 278: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

NotesViewInfo.View (NotesViewInfo object)

264 MapX Reference

Page 279: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ODBCQueryInfo object

An ODBCQueryInfo object is passed into the DataSets.Add method as the source parameter if the DataSet type is miDataSetODBC. This object contains information about how to connect to an ODBC data source and which records to treat as the record set.

Note: If you use the ODBCQueryInfo object, your project must reference MODBCDataset.DLL ("MapInfo ODBC Dataset Engine Library") and MMapXColumnInfo.dll.

In Visual Basic, choose Tools > References (for VB 4) or Project > References (for VB 5). Click the Browse button to add references to appropriate dlls. The dlls are installed in the MapX Program directory.

Object Properties• ODBCQueryInfo.ConnectString property (ODBCQueryInfo object)• ODBCQueryInfo.DataSource property (ODBCQueryInfo object)• ODBCQueryInfo.SqlQuery property (ODBCQueryInfo object)

Example in Visual Basic

Private Sub Command2_Click()

Dim ds As Dataset

Dim parm As New ODBCQueryInfo

parm.SqlQuery = "select * from usa"

parm.DataSource = "u "' name of odbc datasource

parm.ConnectString = "ODBC; "' can be left blank, or can

'include user= or pwd=

Set ds = Map.Datasets.Add(miDataSetODBC, parm, "odbc Dataset")

For Each fd In ds.Fields

MsgBox fd.Name

Next

If Not ds Is Nothing Then ds.Themes.Add

End Sub

Example in C++

void CSampleProjectView::ODBCDatasetAdd() {

CString msg("Fields:\n\t");

CMapXDataset ds;

COleVariant parmVariant;

CMapXODBCQueryInfo parm;

Page 280: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ODBCQueryInfo object

long i,FieldCount;

parm.CreateDispatch(parm.GetClsid());

try {

parm.SetSqlQuery("select * from usa");

parm.SetDataSource("usa"); // name of odbc datasource

parm.SetConnectString("ODBC;"); // Can be left blank, or can include user= or pwd=

parmVariant.vt = VT_DISPATCH;

parmVariant.pdispVal = parm.m_lpDispatch;

ds = m_Map.GetDatasets().Add(miDataSetODBC,parmVariant,"odbc Dataset");

FieldCount = ds.GetFields().GetCount();

for(i=1;i<=FieldCount;i++) {

msg += ds.GetFields().Item(i).GetName();

msg += '\n\t';

}

AfxMessageBox(msg);

if(FieldCount!=0)

ds.GetThemes().Add();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

// ODBCQueryInfo.ConnectString Property (Page 150)

void CSampleProjectView::ODBCDatasetAdd() {

CString msg("Fields:\n\t");

CMapXDataset ds;

COleVariant parmVariant;

CMapXODBCQueryInfo parm;

long i,FieldCount;

parm.CreateDispatch(parm.GetClsid());

try {

parm.SetSqlQuery("select * from usa");

266 MapX Reference

Page 281: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ODBCQueryInfo.ConnectString property (ODBCQueryInfo object)

parm.SetDataSource("usa"); // name of odbc datasource

parm.SetConnectString("ODBC;"); // Can be left blank, or can include user= or pwd=

parmVariant.vt = VT_DISPATCH;

parmVariant.pdispVal = parm.m_lpDispatch;

ds = m_Map.GetDatasets().Add(miDataSetODBC,parmVariant,"odbc Dataset");

FieldCount = ds.GetFields().GetCount();

for(i=1;i<=FieldCount;i++) {

msg += ds.GetFields().Item(i).GetName();

msg += '\n\t';

}

AfxMessageBox(msg);

if(FieldCount!=0)

ds.GetThemes().Add();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

See Also

DataSets.Add method

ODBCQueryInfo.ConnectString property (ODBCQueryInfo object)

Purpose

Sets the connect string to connect with an ODBC data source. For example, specify "ODBC;". You can also include "uid=" , "pwd=", or DLG=. If information is missing and needed, the ODBC driver for the DataSource will prompt the user.

"DLG=" controls the display of the connection dialog box: DLG=0 means never put up a dialog, DLG=1 means always put one up, DLG=2 displays the connection dialog, but only if needed (i.e., if not all required information was provided).

Mapx Referenc 267

Page 282: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ODBCQueryInfo.ConnectString property (ODBCQueryInfo object)

Example in Visual Basic

Private Sub Command2_Click()

Dim ds As Dataset

Dim parm As New ODBCQueryInfo

parm.SqlQuery = "select * from usa"

parm.DataSource = "u "' name of odbc datasource

parm.ConnectString = "ODBC;"' can be left blank, or can include

' uid= or pwd= or DLG=

Set ds = Map.Datasets.Add(miDatasetODBC, parm, "odbc Dataset")

For Each fd In ds.Fields

MsgBox fd.Name

Next

If Not ds Is Nothing Then ds.Themes.Add

End Sub

Example in C++

// ODBCQueryInfo Object

// BindLayer Object

// Fields Object

void CSampleProjectView::CreateXYTable() {

{

CMapXODBCQueryInfo QueryInfo;

COleVariant BindLayerVt,FieldsVt,QueryInfoVt;

CMapXFields Fields;

CMapXBindLayer BindLayer;

// Create new instances of the Fields, ODBCQueryInfo, and BindLayer objects

if(!Fields.CreateDispatch(Fields.GetClsid())) {

TRACE0("Failed to Create Fields Object");

return;

}

if(!QueryInfo.CreateDispatch(QueryInfo.GetClsid())) {

TRACE0("Failed to Create ODBCQueryInfo Object!");

return;

}

if(!BindLayer.CreateDispatch(BindLayer.GetClsid())) {

TRACE0("Failed to Create BindLayer Object!");

return;

}

268 MapX Reference

Page 283: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ODBCQueryInfo.ConnectString property (ODBCQueryInfo object)

try {

// You can specify a username and password in the Connect String

QueryInfo.SetConnectString("ODBC;");

// Not specifying a datasource will pop up a datasource dialog

// If the data source name is known in advance, you can avoid relying on

// the user to find the Mapstats.mdb database

QueryInfo.SetDataSource("");

// The US_CUST recordset is in the Mapstats.mdb database

// Note: It is possible to only select the fields you want

// For example: QueryInfo.SetSqlQuery("select COMPANY,X,Y,ORDER_AMT from US_CUST");

// Or other more complex SQL querys

QueryInfo.SetSqlQuery("select * from US_CUST");

QueryInfoVt.vt = VT_DISPATCH;

QueryInfoVt.pdispVal = QueryInfo;

// Create a permanent layer in the MapX directory (if the layer already exists,

// the user will get an error in Datasets.Add)

// This layer will have one column, which is the GeoField specified in Datasets.Add

// In this case, it is the company name

BindLayer.SetFilespec("C:\\Program Files\\MapInfo MapX\\Maps\\CustLayer.tab");

BindLayer.SetLayerName("Customers");

BindLayer.SetLayerType(miBindLayerTypeXY);

// For layers of type miBindLayerTypeXY, RefColumn1 must be the column that contains

// X coordinates, and RefColumn2 must be the column that contains Y coordinates

BindLayer.SetRefColumn1("X");

BindLayer.SetRefColumn2("Y");

BindLayerVt.vt = VT_DISPATCH;

BindLayerVt.pdispVal = BindLayer;

// This specifies which fields from the source data to add and how to add them

Mapx Referenc 269

Page 284: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ODBCQueryInfo.DataSource property (ODBCQueryInfo object)

Fields.Add(COleVariant("COMPANY"),COleVariant("Company"),COleVariant((long)miAggregationIndividual),COleVariant((long)miTypeString));

Fields.Add(COleVariant("X"),COleVariant("X"),COleVariant((long)miAggregationAverage),COleVariant((long)miTypeNumeric));

Fields.Add(COleVariant("Y"),COleVariant("Y"),COleVariant((long)miAggregationAverage),COleVariant((long)miTypeNumeric));

Fields.Add(COleVariant("ORDER_AMT"),COleVariant("Order_Amt"),COleVariant((long)miAggregationSum),COleVariant((long)miTypeNumeric));

FieldsVt.vt = VT_DISPATCH;

FieldsVt.pdispVal = Fields;

// The Company Field is the used as the unique GeoField

m_Map.GetDatasets().Add(miDataSetODBC,QueryInfoVt,COleVariant("Customers Data"),COleVariant("Company"),COptionalVariant(),BindLayerVt,FieldsVt,COptionalVariant());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

ODBCQueryInfo.DataSource property (ODBCQueryInfo object)

Purpose

Sets the name of the ODBC data source. If this property is left blank, ODBC will prompt the user. ODBC DataSources are set up using the ODBC administrator, which can be found in the Windows95 or Windows NT Control Panel.

ODBCQueryInfo.SqlQuery property (ODBCQueryInfo object)

Purpose

Specifies the SQL query string which is used to retrieve the rows and columns to build a dataset. For example, specify "select * from USA".

270 MapX Reference

Page 285: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Parts collection

A Parts object is a collection of Points collection objects. It has the normal Count, Item, and Remove methods. The Add method takes a Source Points object and returns the Points object added to the Parts collection (i.e., a new Points object is added to the Parts collection and the points are copied from the Source Points collection).

Collection Properties• Parts.Count property • Parts.Item property

Collection Methods• Parts.Add method• Parts.Remove method • Parts.RemoveAll method

Example for parts, points and point in Visual Basic

' create a polyline feature with 3 points

Dim newobj as new MapXLib.Feature 'standalone object

Dim obj as MapXLib.Feature 'to hold object added to layer

Dim pts as new Points

Dim pt as new Point

newobj.Type = miFeatureTypeLine

'Use the map's default symbol style

newobj.Style = map1.DefaultStyle

'set the lines 3 points

pt.Set -101.023, 45.0452

pts.Add pt

pt.Set -102.023, 49.0452

pts.Add pt

pt.Set -100.0, 34.2564

pts.Add pt

newobj.Parts.Add pts

'now add the object to a layer

' obj will be the newly added object

set obj = map1.Layers(1).AddFeature(newobj)

Page 286: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Parts collection

Example in C++

void CSampleProjectView::CreatePolyFeature() {

// Create a polyline feature with 3 points

CMapXFeature obj,newobj;

CMapXPoints pts;

CMapXPoint pt;

if(!newobj.CreateDispatch(newobj.GetClsid())) {

TRACE0("Failed to create Feature object");

return;

}

if(!pts.CreateDispatch(newobj.GetClsid())) {

TRACE0("Failed to create Points collection");

return;

}

if(!pt.CreateDispatch(newobj.GetClsid())) {

TRACE0("Failed to create Point object");

return;

}

try {

newobj.SetType(miFeatureTypeLine);

newobj.SetStyle(m_Map.GetDefaultStyle()); // Use the _

map's default symbol style

pt.Set(-101.023,45.0452);

pts.Add(pt);

pt.Set(-102.023,49.0452);

pts.Add(pt);

pt.Set(-100.0,34.2564);

pts.Add(pt);

newobj.GetParts().Add(pts);

obj = m_Map.GetLayers().Item(1).AddFeature(newobj); _

// obj will be the newly added object

} catch (COleDispatchException *e) {

272 MapX Reference

Page 287: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Parts.Add method (Parts collection)

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Parts.Add method (Parts collection)

Purpose

The Add method takes a Source Points object and returns the Points object added to the Parts collection (i.e., a new Points object is added to the Parts collection and the points are copied from the Source Points collection).

Syntax

OBJECT.PartsAdd(Points)

Points is the Points collection object you want to add.

Parts.Count property (Parts collection)

Purpose

Number of items in collection.

Parts.Item property (Parts collection)

Purpose

Return a Points collection object from collection. This is a Variant and you can specify the point's name or 1 based index number. This is a default property of the Parts collection.

Parts.Remove method (Parts collection)

Purpose

Remove a Points collection object from this collection.

Syntax

OBJECT.Remove (index)

Mapx Referenc 273

Page 288: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Parts.RemoveAll method (Parts collection)

Parts.RemoveAll method (Parts collection)

Purpose

Removes all Parts objects from the collection.

Syntax

OBJECT.RemoveAll

Example In Visual Basic

Private Sub btnPartsRemoveAll_Click()

Dim newobj As New MapXLib.Feature 'stand-alone object

Dim pts As New Points

Dim pt As New Point

Dim nPnts As Integer

Dim nParts As Integer

newobj.Attach Map1

newobj.Type = miFeatureTypeLine

' Use the map's default symbol style

newobj.Style = Map1.DefaultStyle

'set the lines 3 points

'Also could use pts.AddXY here

pt.Set -101.023, 45.0452

pts.Add pt

pt.Set -102.023, 49.0452

pts.Add pt

pt.Set -100.012, 34.2564

pts.Add pt

' Add the points into the parts collection

newobj.Parts.Add pts

nParts = newobj.Parts.Count

' remove all of the parts

newobj.Parts.RemoveAll

nParts = newobj.Parts.Count

End Sub

274 MapX Reference

Page 289: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Parts.RemoveAll method (Parts collection)

Example in C++

void CSampleProjectView::RemoveAllPoints() {

CMapXFeature newobj;

CMapXPoints pts;

CMapXPoint pt;

if(!newobj.CreateDispatch(newobj.GetClsid())) {

TRACE0("Failed to create Feature object");

return;

}

if(!pts.CreateDispatch(newobj.GetClsid())) {

TRACE0("Failed to create Points collection");

return;

}

if(!pt.CreateDispatch(newobj.GetClsid())) {

TRACE0("Failed to create Point object");

return;

}

try {

newobj.Attach(m_Map.GetDispatch());

newobj.SetType(miFeatureTypeLine);

newobj.SetStyle(m_Map.GetDefaultStyle());

pt.Set(-101.023,45.0452);

pts.Add(pt);

pt.Set(-102.023,49.0452);

pts.Add(pt);

pt.Set(-100.012,34.2564);

pts.Add(pt);

// Add the points into the parts collection

newobj.GetParts().Add(pts);

// now, remove all of the parts

newobj.GetParts().RemoveAll();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {e->ReportError();e->Delete();

}}

Mapx Referenc 275

Page 290: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Parts.RemoveAll method (Parts collection)

276 MapX Reference

Page 291: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Point object and Points collection

The Point object represents an XY coordinate pair. When a Point belongs to a Feature, the X coordinate represents longitude, and the Y coordinate represents latitude.

Object Properties• Point.X property (Point object)• Point.Y property (Point object)

Object Methods• Point.Offset method (Point object)• Point.Set method (Point object)

Collection Properties• Points.Count property (Points collection)• Points.Item property (Points collection)

Collection Methods• Points.Add method (Points collection)• Points.AddXY method (Points collection)• Points.Remove method (Points collection)• Points.RemoveAll method (Points collection)

Example in Visual Basic

'Print out all points in first object of selection

Dim obj as MapXLib.Feature 'to hold object added to layer

Dim pts as Points

Dim pt as Point

set obj = map1.layers(1).selection(1)

for each pts in obj.parts

for each pt in pts

debug.print pt.x, pt.y

next

next

Page 292: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Point object and Points collection

Example in C++

void CSampleProjectView::PrintSelectedPoints() {

CMapXFeature obj;

CMapXPoints pts;

CMapXPoint pt;

CString ptmsg,msg;

long i,j,PointsCount,PointCount;

try {

obj = m_Map.GetLayers().Item(1).GetSelection().Item(1);

PointsCount= obj.GetParts().GetCount();

for(i=1;i<=PointsCount;i++) {

pts= obj.GetParts().Item(i);

PointCount=pts.GetCount();

for(j=1;j<=PointCount;j++) {

pt=pts.Item(i);

ptmsg.Format("%d, %d",pt.GetX(),pt.GetY());

msg += ptmsg;

}

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

AfxMessageBox(msg);

}

278 MapX Reference

Page 293: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Point.Offset method (Point object)

Point.Offset method (Point object)

Purpose

Changes the position of a point by changing its coordinates.

Syntax

OBJECT.Offset(double deltaX, double deltaY)

See Also

Map.Numeric CoordSys

Point.Set metho (Point object)

Purpose

Set the coordinates of a point.

Syntax

OBJECT.Set(double X, double Y)

Parts Description

OBJECT Represents a Point object.

deltaX The amount to add to the x coordinate.

deltaY The amount to add to the y coordinate.

double DeltaX and deltaY are values in the Map's Numeric Coordinate System.

Parts Description

OBJECT Represents a Point object.

X X is the x coordinate of the point.

Y Y is the y coordinate of the point.

double DeltaX and deltaY are values in the Map's Numeric Coordinate System.

Mapx Referenc 279

Page 294: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Point.X property (Point object)

Point.X property (Point object)

Purpose

The point's X coordinate. X and Y are values in the Map's numeric coordinate system.

See Also

Map.NumericCoordSys

Point.Y property (Point object)

Purpose

The point's Y coordinate. X and Y are values in the Map's numeric coordinate system.

See Also

Map.NumericCoordSys

Points.Add metho (Points collection)

Purpose

Adds a point to the Point collection.

Syntax

[ Point= ]OBJECT Add(Point, [Position])

Example in C++

// Point.Set Method

// Points.Add Method

// Points.AddXY Method

// Parts.Add Method

void CSampleProjectView::FtrCreate() {

CMapXFeature Ftr;

Parts Description

OBJECT Represents a Points object.

Point The Point object to add.

Position An integer between 1 and Points.Count, specifying the position in the collection where the point should be added. If it is not specified or invalid, the point will be appended to the end of the colleciton.

280 MapX Reference

Page 295: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Points.Add method (Points collection)

CMapXPoints pts1,pts2;

CMapXPoint pt;

if(!Ftr.CreateDispatch(Ftr.GetClsid()) || !pts1.CreateDispatch(pts1.GetClsid()) ||

!pts2.CreateDispatch(pts2.GetClsid()) || !pt.CreateDispatch(pt.GetClsid())) {

TRACE0("Failed to Create object in CSampleProjectView::FtrCreate");

return;

}

try {

Ftr.Attach(m_Map.GetDispatch());

Ftr.SetType(miFeatureTypeRegion);

// Make a new region feature with two triangles

pt.Set(m_Map.GetCenterX()+10.0,m_Map.GetCenterY());

pts1.Add(pt);

pt.Set(m_Map.GetCenterX()+10.0,m_Map.GetCenterY() + 5.0);

pts1.Add(pt);

pt.Set(m_Map.GetCenterX()+15.0,m_Map.GetCenterY());

pts1.Add(pt);

// This performs the same operation (with different coordinates)

// using the AddXY method

pts2.AddXY(m_Map.GetCenterX()-10.0,m_Map.GetCenterY());

pts2.AddXY(m_Map.GetCenterX()-10.0,m_Map.GetCenterY()-5.0);

pts2.AddXY(m_Map.GetCenterX()-15.0,m_Map.GetCenterY());

// Add the two trianges to the new region

Ftr.GetParts().Add(pts1);

Ftr.GetParts().Add(pts2);

// Add the region to a temporary layer

Map1.GetLayers().Item("Temp Layer").AddFeature(Ftr);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

Mapx Referenc 281

Page 296: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Points.Add method (Points collection)

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub FtrCreate_Click()

Dim Ftr As New Feature

Dim pts1 As New Points, pts2 As New Points

Dim pt As New Point

Ftr.Attach Map1

Ftr.Type = miFeatureTypeRegion

' Make a new region feature with two triangles

pt.Set Map1.CenterX + 10, Map1.CenterY

pts1.Add pt

pt.Set Map1.CenterX + 10, Map1.CenterY + 5

pts1.Add pt

pt.Set Map1.CenterX + 15, Map1.CenterY

pts1.Add pt

' This performs the same operation (with different

' coordinates)using the AddXY method

pts2.AddXY Map1.CenterX - 10, Map1.CenterY

pts2.AddXY Map1.CenterX - 10, Map1.CenterY - 5

pts2.AddXY Map1.CenterX - 15, Map1.CenterY

' Add the two triangles to the new region

Ftr.Parts.Add pts1

Ftr.Parts.Add pts2

' Add the region to a temporary layer

Map1.Layers.Item("Temp Layer").AddFeature Ftr

End Sub

282 MapX Reference

Page 297: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Points.AddXY method (Points collection)

Points.AddXY method (Points collection)

Purpose

This method creates a new point with the given X and Y values and adds it to a Points collection.

Syntax

[ Point= ]OBJECT.AddXY (x, y, [Position])

Points.Count property (Points collection)

Purpose

This is the number of items in a collection.

Points.Item property (Points collection)

Purpose

Return a Point object from collection. This is a Variant and you can specify the point's name or 1 based index number. This is a default property of the Points collection.

Points.Remove metho (Points collection)

Purpose

Remove a Point object from this collection.

Syntax

OBJECT.Remove (index)

Part Description

OBJECT Represents a Points object.

x Double numeric CoordSys.

y Double numeric CoordSys.

Position An integer between 1 and Points.Count, specifying the position in the collection where the point should be added. If it is not specified or invalid, the point will be appended to the end of the colleciton.

Mapx Referenc 283

Page 298: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Points.RemoveAll method (Points collection)

Points.RemoveAll metho (Points collection)

Purpose

Removes all Point objects from the collection.

Syntax

OBJECT RemoveAll

Example in Visual Basic

Private Sub btnPointsRemoveAll_Click()

Dim pts As New Points

Dim pt As New Point

Dim nPnts As Integer

' add points to the points collection

pt.Set -101.023, 45.0452

pts.Add pt

pt.Set -102.023, 49.0452

pts.Add pt

pt.Set -100.012, 34.2564

pts.Add pt

nPnts = pts.Count

' remove all of the points

pts.RemoveAll

nPnts = pts.Count

End Sub

Example in C++

void CSampleProjectView::PointsRemoveAll() {

CMapXPoints pts;

CMapXPoint pt;

// Create the Points object

if(!pts.CreateDispatch(pts.GetClsid())) {

TRACE0("Failed to Create Points collection");

return;

}

// Create a Point object

if(!pt.CreateDispatch(pt.GetClsid())) {

TRACE0("Failed to Create Point object");

return;

284 MapX Reference

Page 299: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Points.RemoveAll method (Points collection)

}

try {

// add several points to the points collection

pt.Set(-101.023,45.0452);

pts.Add(pt);

pt.Set(-102.023,49.0452);

pts.Add(pt);

pt.Set(-100.012,34.2564);

pts.Add(pt);

// now, remove all of the points

pts.RemoveAll();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Mapx Referenc 285

Page 300: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Points.RemoveAll method (Points collection)

286 MapX Reference

Page 301: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RangeCategory object and RangeCategories collection

A Ranged thematic map's settings are exposed through the RangeCategories collection, which is a collection of RangeCategory objects, one object for each range, sorted in ascending order. Each object in the collection describes one range (its display style, its minimum and maximum values, etc).

Object Properties• RangeCategory.Max property • RangeCategory.Min property • RangeCategory.NumItems property • RangeCategory.Style property

Collection Properties• RangeCategories.AllOthersCategory property • RangeCategories.Count property • RangeCategories.Item property

Example in C++

// RangeCategories Object

void CSampleProjectView::ChangeChart(CMapXTheme& InTheme) {

try {

switch(InTheme.GetType()) {

case miThemeBarChart:

case miThemePieChart:

//...

break;

case miThemeRanged:

// Change the theme to have three ranges, colors white, magenta, and red

InTheme.GetThemeProperties().SetNumRanges(3);

InTheme.GetThemeProperties().GetRangeCategories().Item(1) .GetStyle().SetRegionColor(miColorWhite);

InTheme.GetThemeProperties().GetRangeCategories().Item(2) .GetStyle().SetRegionColor(miColorMagenta);

InTheme.GetThemeProperties().GetRangeCategories().Item(3).GetStyle().SetRegionColor(miColorRed);

break;

Page 302: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RangeCategories.AllOthersCategory property (RangeCategories collection)

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub ChangeChart(InTheme as MapXLib.Theme)

Select Case Theme.Type

Case miThemeBarChart, miThemePieChart

' ...

Case miThemeRanged

' Change the theme to have three ranges, colors White,

' Magenta, and Red

InTheme.ThemeProperties.NumRanges = 3

InTheme.ThemeProperties.RangeCategories(1).Style. _

RegionColor = miColorWhite

InTheme.ThemeProperties.RangeCategories(2).Style. _

RegionColor = miColorMagenta

InTheme.ThemeProperties.RangeCategories(3).Style. _

RegionColor = miColorRed

End Select

End Sub

RangeCategories.AllOthersCategory property (RangeCategories collection)

Purpose

Returns one RangeCategory object from the collection; this object describes a category for all ranges not in the ranged theme. The RangeCategory object returned with the AllOthersCategory has Min and Max properties that are not defined and their default value is zero. However, you can set its Style property as shown in the example below. The text that appears in the legend for the AllOthersCategory range category object can be set with LegendTexts.AllOthersText property

Example

Dim ds As Dataset

288 MapX Reference

Page 303: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RangeCategories.Count property (RangeCategories collection)

Dim lyr as Layer

Dim thm As MapXLib.Theme

Dim AllOthers As MapXLib.RangeCategory

Dim styl As MapXLib.Style

Set lyr = Map1.Layers.Add("states.tab", 1)

Set ds = Map1.Datasets.Add(miDataSetLayer, Map1. _

Layers("STATES"))

ds.Themes.Add miThemeRanged, "POP_1990", "My Theme", False

Set thm = ds.Themes("My Theme")

thm.DataMin = 1000000

thm.DataMax = 3000000

thm.Visible = Tru

Set styl = Map1.DefaultStyle

styl.PickRegion

Set AllOthers = thm.ThemeProperties. _

RangeCategories.AllOthersCategory

AllOthers.Style = styl

RangeCategories.Count property (RangeCategories collection)

Purpose

Read-only integer value, indicating the number of ranges in the ranged theme.

RangeCategories.Item property (RangeCategories collection)

Purpose

Returns one RangeCategory object from the collection; this object describes a range in the ranged theme.

Mapx Referenc 289

Page 304: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RangeCategory.Max property (RangeCategory object)

RangeCategory.Max property (RangeCategory object)

Purpose

Contains or sets the maximum value for a range in a Ranged theme. This is a Double value. An initial value is set when the theme is created (Themes.Add) depending on the distribution method (ThemeProperties.DistMethod):

• If ThemeProperties.DistMethod is miEqualCountPerRange, miEqualRangeSize, miNaturalBreak, or miStandardDeviation, a new value will be set each time the Theme object is recomputed.

• If ThemeProperties.DistMethod is miCustomRanges, MapX will assume that you have set this value yourself, and will use the ranges that you have defined when grouping data values. An error is generated if there are ranges that overlap when the Theme is recomputed.

See Also

ThemeProperties.DistMethod

RangeCategory.Min property (RangeCategory object)

Purpose

Contains or sets the minimum value for a range in a Ranged theme. This is a Double value. An initial value is set when the theme is created (Themes.Add) depending on the distribution method (ThemeProperties.DistMethod):

• If ThemeProperties.DistMethod is miEqualCountPerRange, miEqualRangeSize, miNaturalBreak, or miStandardDeviation, a new value will be set each time the Theme object is recomputed.

• If ThemeProperties.DistMethod is miCustomRanges, MapX will assume that you have set this value yourself, and will use the ranges that you have defined when grouping data values. An error is generated if there are ranges that overlap when the Theme is recomputed.

See Also

ThemeProperties.DistMethod

Themes.Add

Theme.AutoRecompute

290 MapX Reference

Page 305: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RangeCategory.NumItems property (RangeCategory object)

RangeCategory.NumItems property (RangeCategory object)

Purpose

NumItems is the number of features that fall into the range specified by the Min and Max properties for this range category. This is an Integer value and is a read-only property

Note: This property is only valid when MapX generates the theme (Theme.ComputeTheme = TRUE). If you are manually calculating the theme (Theme.ComputeTheme = FALSE), then NumItems will NOT reflect the number of items in the category and is undefined as a result.

RangeCategory.Style property (RangeCategory object)

Purpose

Contains the Style for all objects within the Min and Max properties' range for the given RangeCategory object. It may be set to an existing style object or you may set the Style properties individually.

Mapx Referenc 291

Page 306: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RangeCategory.Style property (RangeCategory object)

292 MapX Reference

Page 307: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Rectangle object

Rectangle objects are used to specify the extents of an object. Several properties, such as Map.Bounds, Feature.Bounds, and Layer.Bounds, are rectangle objects. A rectangle is defined by its minimum and maximum X coordinates, and its minimum and maximum Y coordinates. For geographic properties (such as Map.Bounds), these coordinates will be specified in terms of the Map.NumericCoordSys. For methods relating to Windows (such as Style.DrawLineSample), the properties of the Rectangle object will be in pixel values.

Object Properties• Rectangle.Height property • Rectangle.Width property • Rectangle.XMax property • Rectangle.XMin property • Rectangle.YMax property • Rectangle.YMin property

Object Methods• Rectangle.Offset method • Rectangle.Set method

Rectangle.Height property (Rectangle object)

Purpose

The height of the rectangle. The height is defined as Rectangle.YMax - Rectangle.YMin. This is a read-only Double property. To change the height of the rectangle, use the Rectangle.Set method.

Rectangle.Offset method (Rectangle object)

Purpose

Changes the position of a rectangle by changing its coordinates. This shifts the rectangle by deltaX in the X direction and deltaY in the Y direction.

Page 308: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Rectangle.Set method (Rectangle object)

Syntax

Object.Offset( deltaX, deltaY )

Rectangle.Set method (Rectangle object)

Purpose

Sets the coordinates of a rectangle. Rectangle.Set will sort the parameters to ensure that Rectangle.XMin <= Rectangle.XMax and Rectangle.YMin <= Rectangle.YMax. You're allowed to pass parameters where x1 > x2 or y1 > y2.

Syntax

OBJECT.Set (x1, y1, x2, y2)

Rectangle.Width property (Rectangle object)

Purpose

The width of the rectangle. The width is defined as Rectangle.XMax - Rectangle.XMin. This is a read-only Double property. To change the width of the rectangle, use the Rectangle.Set method.

Rectangle.XMax property (Rectangle object)

Purpose

The coordinate of the left edge of the rectangle. It is a read-only Double property. In order to change the location of the rectangle, use the Rectangle.Set or Rectangle.Offset methods.

Part Description

OBJECT Represents a Rectangle object.

deltaX Double value, representing the amount to shift the rectangle in the X direction.

deltaY Double value, representing the amount to shift the rectangle in the Y direction.

Part Description

OBJECT Represents a Rectangle object.

x1, y1 Double values, representing the coordinates of one corner of the rectangle.

x2, y2 Double values, representing the coordinates of the opposite corner of the rectangle.

294 MapX Reference

Page 309: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Rectangle.XMin property (Rectangle object)

Rectangle.XMin property (Rectangle object)

Purpose

The coordinate of the right edge of the rectangle. It is a read-only Double property. In order to change the location of the rectangle, use the Rectangle.Set or Rectangle.Offset methods.

Rectangle.YMax property (Rectangle object)

Purpose

The coordinate of the top edge of the rectangle. It is a read-only Double property. In order to change the location of the rectangle, use the Rectangle.Set or Rectangle.Offset method.

Rectangle.YMin property (Rectangle object)

Purpose

The coordinate of the bottom edge of the rectangle. It is a read-only Double property. In order to change the location of the rectangle, use the Rectangle.Set or Rectangle.Offset method.

Mapx Referenc 295

Page 310: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Rectangle.YMin property (Rectangle object)

296 MapX Reference

Page 311: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ResolveObject object and ResolveObjects collection

A ResolveObjects collection is passed as a parameter to the ResolveDataBindEx event. It is a collection of the candidate layers which may be bound to when using automatic databinding.

Object Properties• ResolveObject.TableName (ResolveObject object)• ResolveObject.SourceMatch (ResolveObject object)• ResolveObject.TableMatch (ResolveObject object)

Collection Properties• ResolveObjects.Count property (ResolveObjects collection)• ResolveObjects.Item property (ResolveObjects collection)

See Also

ResolveDataBindEx event

ResolveObject.TableName property (ResolveObject object)

Purpose

This property is used to set the name of table being resolved.

ResolveObject.SourceMatch (ResolveObject object)

Purpose

Percentage of source rows matching the table. Example: If the source data is 5 rows and 4 match this vaule = 80.

ResolveObject.TableMatch (ResolveObject object)

Purpose

Percentage of map objects matching the source data. Example: If the source data is 5 rows and 4 match and the map has 50 objects then the value = 8.

Page 312: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ResolveObjects.Count property (ResolveObjects collection)

ResolveObjects.Count property (ResolveObjects collection)

Purpose

Number of items in collection.

ResolveObjects.Item property (ResolveObjects collection)

Purpose

Returns a ResolveObject object from a collection. This is a Variant and you can specify the name or 1 based index number. This is a default property of the ResolveObjects collection.

298 MapX Reference

Page 313: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RowValue object and RowValues collection

The RowValue object represents a single value for a field in a dataset. A collection of RowValue objects is returned by Dataset.RowValues.

RowValues collection is a group of createable RowValue objects. The RowValues collection can be passed to Layer.UpdateFeature, Layer.AddFeature, and Feature.Update to specify data values for fields in datasets that are bound to the layer being updated.

Object Properties• RowValue.ReadOnly property (RowValue object)• RowValue.Dataset property (RowValue object)• RowValue.Field property (RowValue object)• RowValue.Value property (RowValue object)

Collection Properties• RowValues.Count property (RowValues collection)• RowValues.ReadOnly property (RowValues collection)• RowValues.Item property (RowValues collection)

Collection Methods• RowValues.Remove method (RowValues collection)• RowValues.Add method (RowValues collection)• RowValues.RemoveAll method (RowValues collection)• RowValues.Clone method (RowValues object)

Example

' dump dataset to the debug window

dim fs as Features

dim F as Feature

dim rv as RowValue

dim rvs as RowValues

Dim s As String

Map1.Layers.Item("usa").BeginAccess miAccessRead

Set fs = Map1.Layers.Item("usa").AllFeatures

For Each F In fs

Page 314: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RowValue.ReadOnly property (RowValue object)

Set rvs = Map1.Datasets.Item(1).RowValues(F)

s = ""

For Each rv In rvs

s = s & rv.Value & ", " ' concat each column's values _together separated by commas

Next

s = Left(s, Len(s) - 2) ' strip off trailing comma

Debug.Print s

Next

Map1.Layers.Item("usa").EndAccess miAccessEnd

See Also

Layer.UpdateFeature method

Layer.AddFeature method

Feature.Update method

Dataset.RowValues property

RowValue.ReadOnly property (RowValue object)

Purpose

This property determines whether or not the properties can be set on the object.

RowValue.Dataset property (RowValue object)

Purpose

This property is used to specify which dataset the value is for.

RowValue.Field property (RowValue object)

Purpose

This property is used to specify the field in the dataset that the value is for.

RowValue.Value property (RowValue object)

Purpose

This property is used to specify the value for the field.

300 MapX Reference

Page 315: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RowValues.Count property (RowValues collection)

RowValues.Count property (RowValues collection)

Purpose

This read-only property specifies the number of rows in the the RowValues collection.

RowValues.ReadOnly property (RowValues collection)

Purpose

This read-only property specifies whether or not properties can be set on the collection. Read-only will be "True" for the Datasets.RowValues collection and "False" for independantly created RowValues objects.

RowValues.Item property (RowValues collection)

Purpose

This returns a specific RowValue object from the RowValues collection.

Syntax

OBJECT Item (index)

RowValues.Remove method (RowValues collection)

Purpose

This method removes a specified RowValue object from the collection.

Note: Though removed from the collection, it will leave the dataset in tact.

Parts Description

OBJECT Represents a RowValues collection.

index Variant: This specifies which item in the collection to return. It can be either a field name or a numeric index.

Mapx Referenc 301

Page 316: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RowValues.Add method (RowValues collection)

Syntax

OBJECT Remove (index)

RowValues.Add method (RowValues collection)

Purpose

This property adds a RowValue object to a specified RowValues collection.

Syntax

[ RowValues= ] OBJECT Add (RowValue)

RowValues.RemoveAll method (RowValues collection)

Purpose

This method removes all RowValue objectss from a RowValues collection.

Note: Though removed from the collection, it will leave the dataset in tact.

Syntax

OBJECT RemoveAll

Parts Description

OBJECT Represents a RowValues collection.

index Variant: This specifies the item in the collection to remove. It can be either a field name or a numeric index.

Parts Description

OBJECT Represents a RowValues collection.

RowValue This represents a RowValue object to add to the collection.

Parts Description

OBJECT Represents a RowValues collection.

302 MapX Reference

Page 317: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RowValues.Clone method (RowValues object)

RowValues.Clone method (RowValues object)

Purpose

This method clones specified row values from a dataset and returns a new RowValues object. The clone is not read-only or read/write.

Syntax

[ RowValues= ]OBJECT Clone

Parts Description

OBJECT Represents a RowValues collection.

Mapx Referenc 303

Page 318: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RowValues.Clone method (RowValues object)

304 MapX Reference

Page 319: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Selection collection

A fundamental function of MapX is selecting objects or records so that you can perform additional tasks on them such as getting more information. A Selection is a collection of Feature objects.

The Layer.Selection object is a special Features collection in that objects can be added to or removed from it by the end user if they use of any of the selection tools. You can get a snapshot of a layer's selection by using the Clone method to return a Features object.

MapX gives you a number of commands and tools for making selections, the Select tool, Radius Select, Marquee Select, and Boundary Select tool.

To select records with the tools, click on or encircle the associated graphic objects.

Use the property and methods in the Selection collection and Feature objects to obtain additional information or manipulate the features of the collection.

Collection Methods• Selection.Add method (Selection collection)• Selection.ClearSelection method (Selection collection)• Selection.Clone method (Selection collection)• Selection.Common method (Selection collection)• Selection.Remove method (Selection collection)• Selection.Replace method (Selection collection)• Selection.SelectAll method(Selection collection)• Selection.SelectByID method (Selection collection)• Selection.SelectByPoint method (Selection collection)• Selection.SelectByRadius method (Selection collection)• Selection.SelectByRectangle method (Selection collection)• Selection.SelectByRegion method (Selection collection)

Example in Visual Basic

'how to select the objects from a features collectio

dim fs as Features

dim pt as new Point

pt.SetXY -96.731, 39.728

' assumes map unit is miles

set fs = map1.Layers(1).SelectWithinDistance(pt, 50, _miSearchTypePartiallyWithin)

map1.Layers(1).Selection.Replace(fs)

Example in C++

void CSampleProjectView::SelectObjects50Miles() {

Page 320: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Selection.Add method (Selection collection)

CMapXFeatures fs;

CMapXPoint pt;

if(!pt.CreateDispatch(pt.GetClsid())) {

TRACE0("Failed to Create Point object");

return;

}

try {

pt.Set(-96.731,39.728);

fs = m_Map.GetLayers().Item(1).SearchWithinDistance(pt,50,miUnitMile,miSearchTypePartiallyWithin);

m_Map.GetLayers().Item(1).GetSelection().Replace(fs);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

See Also

Layer object

Feature object

Selection.Add method (Selection collection)

Purpose

Add a Feature object or all features from a Selection object into the collection. (UNION set operation).

Syntax

OBJECT.Add (Source)

Parts Description

OBJECT Represents a Selection object.

Source is the Feature object to add.

306 MapX Reference

Page 321: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Selection.Add method (Selection collection)

Example in C++

// Selection.Add Method

void CSampleProjectView::SearchForCapital(CString Capital) {

CMapXFindFeature FoundFeature;

try {

FoundFeature = m_Map.GetLayers().Item("US Capitals"). GetFind().Search(Capital,"");

if(FoundFeature.GetFindRC() % 10 == 1) {

// Found exact match: add this to the current selection

m_Map.GetLayers().Item("US Capitals"). GetSelection(). Add(FoundFeature);

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example in Visual Basic

Private Sub SearchForCapital(Capital As String)

Dim FoundFeature as FindFeature

Set FoundFeature = Map1.Layers("US Capitals"). Find.Search(Capital)

If FoundFeature.FindRC Mod 10 = 1 Then

' Found exact match: add this to the current selection

Map1.Layers("US Capitals").Selection.Add FoundFeature

End If

End Sub

See Also

Feature object

Mapx Referenc 307

Page 322: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Selection.ClearSelection method (Selection collection)

Selection.ClearSelection method (Selection collection)

Purpose

Deselects all features in this layer. Use Layers.ClearSelection to clear the selection from all layers.

Syntax

OBJECT ClearSelection

Selection.Clone method (Selection collection)

Purpose

Make a copy of the collection as a Features collection object.

Syntax

OBJECT Clone

Selection.Common method (Selection collection)

Purpose

Combine this collection and another Selection object so that this collection contains only features that are in both. (INTERSECT set operation).

Syntax

OBJECT Common (Source)

Parts Description

OBJECT Represents a Selection object.

Parts Description

OBJECT Represents a Selection object.

Parts Description

OBJECT Represents a Selection object.

Source A Selection collection or Features collection to combine with OBJECTThis will remove each feature from OBJECT which isn't in the Source collection.

308 MapX Reference

Page 323: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Selection.Remove method (Selection collection)

Selection.Remove metho (Selection collection)

Purpose

Remove a Feature object or all features from a Selection object from this collection. (SUBTRACT set operation).

Syntax

OBJECT.Remove (Source)

See Also

Feature object

Selection.Replace method (Selection collection)

Purpose

Replace the contents of the collection with a Feature object or all features from a Selection collection object.

Syntax

OBJECT.Replace (Source)

See Also

Feature object

Parts Description

OBJECT Represents a Selection object.

Source A Feature object, Selection collection or Features collection to subtract from OBJECT

Parts Description

OBJECT Represents a Selection object.

Source A Feature object, Features collection or Selection collection. OBJECT will be replaced by a collection with all the features from the Source parameter.

Mapx Referenc 309

Page 324: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Selection.SelectAll method(Selection collection)

Selection.SelectAll metho (Selection collection)

Purpose

Selects all features within a layer.

Syntax

Map.Selection.SelectAll SelectionTypeConstant

See Also

SelectionTypeConstant

Example in Visual Basic

Map.Layers("USA").Selection.SelectAll miSelectionNew

Selection.SelectByID method (Selection collection)

Purpose

Selects the feature by FeatureID or FeatureKey

Syntax

OBJECT.SelectByID (FeatureID, Flag, FeatureKey)

Part Description

OBJECT Represents a Selection object.

FeatureID FeatureID of the feature to select.

Flag This controls whether this selected feature is added to, removed from, or replaces the current selection. This takes a SelectionTypeConstants value.

FeatureKey A string that identifies the feature. This is the value returned by Feature.FeatureKey property

310 MapX Reference

Page 325: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Selection.SelectByPoint method (Selection collection)

Selection.SelectByPoint method (Selection collection)

Purpose

Selects the feature at a specified location within the layer

Syntax

OBJECT.SelectByPoint (X, Y, Flag)

Remarks

If you are selecting regions, the SelectByPoint method will select a region that contains the location. If you are selecting points or lines, the method will select a point or line within 3 pixels of the location.

Example in Visual Basic

Private Sub Command1_Click()

' Select NY

Map1.Layers("USA").Selection.SelectByPoint -75.14, _

42.9, miSelectionNew

' Select TX

Map1.Layers("USA").Selection.SelectByPoint -98, _

31.56, miSelectionAppend

' Select CA

Map1.Layers("USA").Selection.SelectByPoint -118.92, 36.75, _

miSelectionAppend

End Sub

Example in C++

void CSampleProjectView::SelectStates() {

try {

// Select NY

m_Map.GetLayers().Item("USA").GetSelection().SelectByPoint(-75.14,42.9,miSelectionNew);

// Select TX

Part Description

OBJECT Represents a Selection object.

X X coordinate of the point to select at. Double value (Longitude).

Y Y coordinate of the point to select at. Double value (Latitude).

Flag This controls whether this selected feature is added to, removed from, or replaces the current selection. This takes a SelectionTypeConstant value.

Mapx Referenc 311

Page 326: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Selection.SelectByRadius method (Selection collection)

m_Map.GetLayers().Item("USA").GetSelection().SelectByPoint(-98,31.56,miSelectionAppend);

// Select CA

m_Map.GetLayers().Item("USA").GetSelection().SelectByPoint(-118.92,36.75,miSelectionAppend);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

See Also

SelectionTypeConstants

Selection.SelectByRadius method (Selection collection)

Purpose

Selects features from the layer within a specified radius around a point. A flag (SelectionTypeConstant) controls whether these selected features are added to, removed from, or replace the current selection.

Syntax

OBJECT SelectByRadius (X, Y, Radius, Flag)

Remarks

A feature is considered to be within "within" the radius if and only if its centroid is within the radius. If you need more control over selection criteria, you may want to use the Layer object's SearchWithinDistance method.

Part Description

OBJECT Represents a Selection object.

X X coordinate of center of circle. Double value (Longitude).

Y Y coordinate of center of circle. Double value (Latitude).

Radius Radius of the search. A Double specifying the distance from the point specified by X and Y in Map units.

Flag This controls whether the selected objects are added to, removed from, or replace the current selection. This takes a SelectionTypeConstants value.

312 MapX Reference

Page 327: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Selection.SelectByRectangle method (Selection collection)

See Also

SelectionTypeConstants

Selection.SelectByRectangle method (Selection collection)

Purpose

Selects features within a rectangle.

Syntax

OBJECT.SelectByRectangle (X1, Y1, X2, Y2, Flag)

Remarks

A feature is considered to be "within" the rectangle if and only if its centroid is within the radius. If more control over selection criteria is needed, you may want to use the Layer object's SearchWithinRectangle method.

Example in Visual Basic

Private Sub Command1_Click()

Map1.Layers("USA").Selection.SelectByRectangle -98, 31.56, _

-75.14,42.9, miSelectionNew

End Sub

See Also

Layer.SearchWithinRectangle method

Part Description

OBJECT Represents a Selection object.

X1 First x coordinate of the rectangle. Double value (Longitude).

Y1 First y coordinate of the rectangle. Double value (Latitude).

X2 Second x coordinate of the rectangle. Double value (Longitude).

Y2 Second y coordinate of the rectangle. Double value (Latitude).

Flag This controls whether the selected objects are added to, removed from, or replace the current selection. This takes a SelectionTypeConstants value.

Mapx Referenc 313

Page 328: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Selection.SelectByRegion method (Selection collection)

Selection.SelectByRegion method (Selection collection)

Purpose

Selects features from the layer within a region. A flag (SelectionTypeConstant) controls whether these selected features are added to, removed from, or replace the current selection.

Syntax

OBJECT.SelectByRegion (Layer, *FeatureKey, Flag)

Example in C++

// Selection.SelectByRegion Method

void CSampleProjectView::SelectCities() {

CMapXFindFeature NYState;

CMapXLayer StateLayer;

try {

StateLayer = m_Map.GetLayers().Item("USA");

// Get the feature that corresponds to New York State

NYState = StateLayer.GetFind().Search("NY","");

if(NYState.GetFindRC() % 10 == 1) { // Found NY

// Unselect anything in this layer and select all the cities in NY

m_Map.GetLayers().Item("US Major Cities").GetSelection(). SelectByRegion(StateLayer,NYState.GetFeatureID(),miSelectionNew);

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {e->ReportError();e->Delete();

}}

Part Description

OBJECT Represents a Selection object.

Layer Layer that the region to select within resides. This takes a Layer object.

FeatureKey *FeatureKey (a string) of the region to select within. This is a replacement for FeatureID parameter. FeatureID still works as it did before, but it is recommended that you use the new FeatureKey parameter.

Flag This controls whether the selected objects are added to, removed from, or replace the current selection. This takes a SelectionTypeConstants value.

314 MapX Reference

Page 329: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Selection.SelectByRegion method (Selection collection)

Example in Visual Basic

Private Sub SelectCities()

Dim NYState As FindFeature

Dim StateLayer As Layer

Set StateLayer = Map1.Layers("USA")

' Get the feature that corresponds to New York State

Set NYState = StateLayer.Find.Search("NY")

If NYState.FindRC mod 10 = 1 Then ' Found NY

'Unselect anything in this layer and select all the

'cities in NY

Map1.Layers("US Major Cities").Selection.SelectByRegion _(StateLayer,NYState.FeatureID,miSelectionNew)

End If

End Sub

Remarks

A feature is considered to be within "within" the region if and only if its centroid is within the radius. If you need more control over selection criteria, you may want to use the Layer object's SearchWithinFeature method.

See Also

SelectionTypeConstants

Feature.FeatureKey property

Mapx Referenc 315

Page 330: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Selection.SelectByRegion method (Selection collection)

316 MapX Reference

Page 331: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

SourceRow object and SourceRows collection

The DataSet.SourceRows property is used to get a collection of rows (as SourceRow objects) from the original data source that were aggregated together for a row in the MapX DataSet.

Use this object to identify which row or rows in the original source data are represented by a row in the MapX DataSet. This is particularly useful when working with Selections and Featurobjects.

Object Properties• SourceRow.Row property

Collection Properties• SourceRows.Count property• SourceRows.Item property

SourceRow.Row property (SourceRow object)

Purpose

Contains the row number from the original data source. This is an Integer value and is Read-only.

The row numbers start at 1 and are sequential in the order that the data was read from the original source data. This is a default property of the SourceRow object.

SourceRows.Count property (SourceRows collection)

Purpose

Contains the number of SourceRow objects in a collection. This is a 1 based Integer value, and is read-only.

SourceRows.Item property (SourceRows collection)

Purpose

This gets a SourceRow object from the collection. An index is used to specify which SourceRow to get. The index is an Integer value from 1 to SourceRows.Count, or a Feature object. This is the default property of the SourceRows collection.

Page 332: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

SourceRows.Item property (SourceRows collection)

Syntax

[ SourceRow= ]OBJECT.Item (index)

The DataSet.SourceRows property is a SourceRows collection, which contains a SourceRow object for each row in the original data source that was aggregated to the row in the MapX DataSet.

You can use a Feature object as the Row parameter, since a feature object uniquely identifies a single row in the Layer that the DataSet is bound to.

Example in C++

// DataSet.SourceRows Property

// SourceRows.Count Property

void CSampleProjectView::QueryRowsTool(CMapXLayer& QueryLayer,CMapXDataset& QueryDataset,double X,double Y) {

CMapXPoint pt;

CMapXFeatures FeaturesAtPoint;

COleVariant FtrVariant;

CMapXFeature ftr;

CString msg;

short RowCount;

if(!pt.CreateDispatch(pt.GetClsid())) {

TRACE0("Failed to Create Point object");

return;

}

try {

pt.Set(X,Y);

FeaturesAtPoint = QueryLayer.SearchAtPoint(pt)

for(long i=1;i<=FeaturesAtPoint.GetCount;i++) {

CString rowMsg;

ftr = FeaturesAtPoint.Item(i);

FtrVariant.vt = VT_DISPATCH;

FtrVariant.pdispVal = ftr;

RowCount = QueryDataset.GetSourceRows(FtrVariant).GetCount();

rowMsg.Format("%d Rows were aggregated from the source data to get data for\n%s\n",RowCount,(LPCSTR)ftr.GetName());

Part Description

OBJECT Represents a SourceRows object.

idex Row in dataset to get value. This is a Variant, and can be a row number or a Feature object.

318 MapX Reference

Page 333: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

SourceRows.Item property (SourceRows collection)

msg += rowMsg;

msg += '\n';

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

AfxMessageBox(msg);

}

Example in Visual Basic

Private Sub QueryRowsTool(QueryLayer As MapXLib.Layer, _

QueryDataset As MapXLib.Dataset, X As Double, Y As Double)

Dim pt As New MapXLib.Point

Dim FeaturesAtPoint As MapXLib.Features

Dim RowCount as Integer

pt.Set X,Y

FeaturesAtPoint = QueryLayer.SearchAtPoint(pt

For Each ftr in FeaturesAtPoint

RowCount = QueryDataset.SourceRows(ftr).Count

Debug.Print RowCount & " Rows were aggregated from _

the source data to get data for """ & ftr.Name & """"

Next

End Sub

Mapx Referenc 319

Page 334: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

SourceRows.Item property (SourceRows collection)

320 MapX Reference

Page 335: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style object

The Style object contains attributes for drawing symbols, lines, regions, and text. The object contains attributes for all feature types, even though a particular feature type only uses a subset of the properties. The property names begin with a keyword indicating the feature type it applies to.

Object Properties• Style.LineColor property • Style.LineInterleaved property • Style.LineStyle property • Style.LineStyleCount property • Style.LineSupportsInterleave property • Style.LineWidth property • Style.LineWidthUnit property • Style.MaxVectorSymbolCharacter property • Style.MinVectorSymbolCharacter property • Style.RegionBackColor property • Style.RegionBorderColor property • Style.RegionBorderStyle property • Style.RegionBorderWidth property • Style.RegionBorderWidthUnit property • Style.RegionColor property • Style.RegionPattern property • Style.RegionTransparent property • Style.SupportsBitmapSymbols property • Style.SymbolBitmapColor property • Style.SymbolBitmapName property • Style.SymbolBitmapOverrideColor property • Style.SymbolBitmapSize property • Style.SymbolBitmapTransparent property • Style.SymbolCharacter property • Style.SymbolFont property • Style.SymbolFontBackColor property • Style.SymbolFontColor property • Style.SymbolFontHalo property • Style.SymbolFontOpaque property • Style.SymbolFontRotation property • Style.SymbolFontShadow property • Style.SymbolType property • Style.SymbolVectorColor property • Style.SymbolVectorSize property • Style.TextFont property

Page 336: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.Clone method (Style object)

• Style.TextFontAllCaps property • Style.TextFontBackColor property • Style.TextFontColor property • Style.TextFontDblSpace property • Style.TextFontHalo property • Style.TextFontOpaque property • Style.TextFontRotation property • Style.TextFontShadow property

Object Methods• Style.Clone method• Style.DrawLineSample method• Style.DrawRegionSample method• Style.DrawSymbolSample method• Style.DrawTextSample method• Style.ExportLineSample method• Style.ExportRegionSample method• Style.ExportSymbolSample method• Style.ExportTextSample method• Style.PickLine method• Style.PickRegion method• Style.PickSymbol method• Style.PickText method

Style.Clone method (Style object)

Purpose

Returns a stand-alone Style object which is a copy of another Style object.

Syntax

OBJECT Clone

The OBJECT placeholder represents a Style object.

Remarks

When you reference a Style object that is owned by another object (for example, using an expression such as objFeature.Style), any changes that you make to the style automatically affect the style's parent object.

322 MapX Reference

Page 337: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.Clone method (Style object)

To create a modified style without affecting the parent object, use the Clone method to create a copy of the style. The style returned by this method is a stand-alone object; changes made to this Style object do not automatically affect any other object. You can assign a stand-alone Style object to any object's Style property

A Style object created through the Clone method supports bitmap symbols if and only if the original Style object supports bitmap symbols.

Example in Visual Basic

Working with copies of Style objects:

The following Visual Basic code example copies a Style _

object, allows the user to modify the style, and then applies _

the modified Style

. Dim s As Style

' copy the style from layer 2 to use as starting point

Set s = Map1.Layers(2).Style.Clone

' let user modify style

s.PickSymbol

' now assign to layer 1

' note that layer 2's style is not affected

Set Map1.Layers(1).Style = s

' make sure that new style is used as override

' for all objects in layer

Map1.Layers(1).OverrideStyle = True

Example In C++

void CSampleProjectView::ChangeStyle() {

CMapXStyle s;

try {

// Copy the style from layer 2 to use as a starting point

s = m_Map.GetLayers().Item(2).GetStyle().Clone();

// Let the user modify the style

s.PickSymbol();

// Now assign to layer 1; layer 2 is not affected

m_Map.GetLayers().Item(1).SetStyle(s);

// Make sure that the new style is used as override

// for all objects in layer

m_Map.GetLayers().Item(1).SetOverrideStyle(TRUE);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

Mapx Referenc 323

Page 338: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.DrawLineSample method (Style object)

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Style.DrawLineSample metho (Style object)

Purpose

This method is used if the user would like to have a sample of a line style drawn into a HDC.

Syntax

OBJECT.DrawLineSample (HDC, Rectangle)

Example in Visual Basic

Dim rect As New MapXLib.Rectangle

' picturebox's ScaleMode must be 'Pixel' for this code to work

rect.Set 0, 0, picturebox.ScaleWidth, picturebox.ScaleHeight

' To draw a line sample:

map1.DefaultStyle.DrawLineSample picturebox.hDC, rect

' To draw a region sample:

map1.DefaultStyle.DrawRegionSample picturebox.hDC, rect

' To draw a symbol sample:

map1.DefaultStyle.DrawSymbolSample picturebox.hDC, rect

' To draw a text sample:

map1.DefaultStyle.DrawTextSample picturebox.hDC, rect, _

"The Quick Brown Cow"

Example in C++

void CSampleProjectView::DrawSample(CWnd& drawto) {

CMapXRectangle rect;

CRect WinRect;

if(!rect.CreateDispatch(rect.GetClsid())) {

TRACE0("Failed to Create Rectangle object");

Parts Description

HDC the DC into which the sample is drawn

Rectangle A Rectangle object that defines the pixel coordinates in the DC that the sample will be draw into. If the sample does not need the entire rectangle to display, the sample will be centered in the rectangle.

324 MapX Reference

Page 339: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.DrawRegionSample method (Style object)

return;

}

drawto.GetWindowRect(&WinRect);

try {

rect.Set(WinRect.left,WinRect.top,WinRect.right,WinRect.bottom);

// Draw a line sample

m_Map.GetDefaultStyle().DrawLineSample((long)drawto.GetDC()->m_hDC,rect);

// Draw a region sample

m_Map.GetDefaultStyle().DrawRegionSample((long)drawto.GetDC()->m_hDC,rect);

// Draw a symbol sample

m_Map.GetDefaultStyle().DrawSymbolSample((long)drawto.GetDC()->m_hDC,rect);

// Draw a text sample

m_Map.GetDefaultStyle().DrawTextSample((long)drawto.GetDC()->m_hDC,rect,"The Quick Brown Cow");

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Style.DrawRegionSample method (Style object)

Purpose

This method is used if the user would like to have a sample of a region style drawn into a HDC.

Mapx Referenc 325

Page 340: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.DrawRegionSample method (Style object)

Syntax

OBJECT.DrawRegionSample (HDC, Rectangle)

Example in Visual Basic

Dim rect As New MapXLib.Rectangle

' picturebox's ScaleMode must be 'Pixel' for this code to work

rect.Set 0, 0, picturebox.ScaleWidth, picturebox.ScaleHeight

' To draw a line sample:

map1.DefaultStyle.DrawLineSample picturebox.hDC, rect

' To draw a region sample:

map1.DefaultStyle.DrawRegionSample picturebox.hDC, rect

' To draw a symbol sample:

map1.DefaultStyle.DrawSymbolSample picturebox.hDC, rect

' To draw a text sample:

map1.DefaultStyle.DrawTextSample picturebox.hDC, rect, _

"The Quick Brown Cow"

Example in C++

void CSampleProjectView::DrawSample(CWnd& drawto) {

CMapXRectangle rect;

CRect WinRect;

if(!rect.CreateDispatch(rect.GetClsid())) {

TRACE0("Failed to create Rectangle object");

return;

}

drawto.GetWindowRect(&WinRect);

try {

rect.Set(WinRect.left,WinRect.top,WinRect.right,WinRect.bottom);

// Draw a line sample

m_Map.GetDefaultStyle().DrawLineSample((long)drawto.GetDC()->m_hDC,rect);

Parts Description

OBJECT This represents a Style object.

HDC The DC into which the sample is drawn.

Rectangle a MapXLib.Rectangle that defines the pixel coordinates in the DC that the sample will be draw into. If the sample does not need the entire rectangle to display, the sample will be centered in the rectangle.

326 MapX Reference

Page 341: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.DrawSymbolSample method (Style object)

// Draw a region sample

m_Map.GetDefaultStyle().DrawRegionSample((long)drawto.GetDC()->m_hDC,rect);

// Draw a symbol sample

m_Map.GetDefaultStyle().DrawSymbolSample((long)drawto.GetDC()->m_hDC,rect);

// Draw a text sample

m_Map.GetDefaultStyle().DrawTextSample((long)drawto.GetDC()->m_hDC,rect,"The Quick Brown Cow");

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Style.DrawSymbolSample method (Style object)

Purpose

This method is used if the user would like to have a sample of a symbol style drawn into a HDC. This method does not work on a MetaFile device context.

Syntax

OBJECT.DrawSymbolSample (HDC, Rectangle)

Parts Description

OBJECT This represents a Style object.

HDC The DC into which the sample is drawn.

Rectangle a MapXLib.Rectangle that defines the pixel coordinates in the DC that the sample will be draw into. If the sample does not need the entire rectangle to display, the sample will be centered in the rectangle.

Mapx Referenc 327

Page 342: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.DrawSymbolSample method (Style object)

Example in Visual Basic

Dim rect As New MapXLib.Rectangle

' picturebox's ScaleMode must be 'Pixel' for this code to work

rect.Set 0, 0, picturebox.ScaleWidth, picturebox.ScaleHeight

' To draw a line sample:

map1.DefaultStyle.DrawLineSample picturebox.hDC, rect

' To draw a region sample:

map1.DefaultStyle.DrawRegionSample picturebox.hDC, rect

' To draw a symbol sample:

map1.DefaultStyle.DrawSymbolSample picturebox.hDC, rect

' To draw a text sample:

map1.DefaultStyle.DrawTextSample picturebox.hDC, rect, _

"The Quick Brown Cow"

Example in C++

void CSampleProjectView::DrawSample(CWnd& drawto) {

CMapXRectangle rect;

CRect WinRect;

if(!rect.CreateDispatch(rect.GetClsid())) {

TRACE0("Failed to Create Rectangle object");

return;

}

drawto.GetWindowRect(&WinRect);

try {

rect.Set(WinRect.left,WinRect.top,WinRect.right,WinRect.bottom);

// Draw a line sample

m_Map.GetDefaultStyle().DrawLineSample(drawto.GetDC()->m_hDC,rect);

// Draw a region sample

m_Map.GetDefaultStyle().DrawRegionSample(drawto.GetDC()->m_hDc, rect);

// Draw a symbol sample

m_Map.GetDefaultStyle().DrawSymbolSample(drawto.GetDC()>m_hDC,rect);

// Draw a text sample

m_Map.GetDefaultStyle().DrawTextSample(drawto.GetDC()>m_hDC,rect,"The Quick Brown Cow");

} catch (COleDispatchException *e) {

e->ReportError();

328 MapX Reference

Page 343: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.DrawTextSample method (Style object)

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Style.DrawTextSample method (Style object)

Purpose

This method is used if the user would like to have a sample of a text style drawn into a HDC.

Syntax

OBJECT.DrawTextSample (HDC, Rectangle, SampleText)

Example in Visual Basic

Dim rect As New MapXLib.Rectangle

' picturebox's ScaleMode must be 'Pixel' for this code to work

rect.Set 0, 0, picturebox.ScaleWidth, picturebox.ScaleHeight

' To draw a line sample:

Map1.DefaultStyle.DrawLineSample picturebox.hDC, rect

' To draw a region sample:

Map1.DefaultStyle.DrawRegionSample picturebox.hDC, rect

' To draw a symbol sample:

Map1.DefaultStyle.DrawSymbolSample picturebox.hDC, rect

' To draw a text sample:

Map1.DefaultStyle.DrawTextSample picturebox.hDC, rect, _

"The Quick Brown Cow"

Parts Description

OBJECT Represents a Style object.

HDC The DC into which the sample is drawn.

Rectangle A MapXLib.Rectangle that defines the pixel coordinates in the DC that the sample will be draw into. If the sample does not need the entire rectangle to display, the sample will be centered in the rectangle.

SampleText The text that the function will use to draw the TextStyle sample.

Mapx Referenc 329

Page 344: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.DrawTextSample method (Style object)

Example in C++

void CSampleProjectView::DrawSample(CWnd& drawto) {

CMapXRectangle rect;

CRect WinRect;

if(!rect.CreateDispatch(rect.GetClsid())) {

TRACE0("Failed to create Rectangle object");

return 0;

}

drawto.GetWindowRect(&WinRect);

try {

rect.Set(WinRect.left,WinRect.top,WinRect.right,WinRect.bottom);

// Draw a line sample

m_Map.GetDefaultStyle().DrawLineSample(drawto.GetDC()->m_hDC,rect);

// Draw a region sample

m_Map.GetDefaultStyle().DrawRegionSample(drawto.GetDC()->m_hDC,rect);

// Draw a symbol sample

m_Map.GetDefaultStyle().DrawSymbolSample(drawto.GetDC()->m_hDC,rect);

// Draw a text sample

m_Map.GetDefaultStyle().DrawTextSample(drawto.GetDC()->m_hDC,rect,"The Quick Brown Cow");

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

330 MapX Reference

Page 345: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.ExportLineSample method (Style object)

Style.ExportLineSample method (Style object)

Purpose

Exports the line style sample.

Syntax

OBJECT.ExportLineSample (Destination, Format, Width, Height, [BackColor])

Example in Visual Basic

'This sample demonstrates the Style.ExportLineSample method.

'It uses

'the method to place a line in the clipboard as a BMP.

Private Sub Command1_Click()

'Export a 2 pixel by 9 pixel Line to the clipboard in BMP Format

Map1. ExportLineSample "clipboard", miFormatBMP, 2, 9, _

miColorWhite

If Clipboard.GetFormat(vbCFBitmap) Then

Debug.Print "Clipboard contains a BMP"

Else

Debug.Print "Clipboard does not contain a BMP"

End If

End Sub

Part Description

OBJECT Represents a Style object

Destination File specification of where to put the output, such as "C:\Temp\Symbol.bmp". If you specify "CLIPBOARD" instead of a file path, the image is put on the clipboard.

Format Output format. This takes an ExportFormatConstants value. Note: If you specify miFormatGIF (to generate GIF files), please read the Licensing Requirements for Users of GIF Files.

Width Width of output. This is a double value, and specifies width in terms of pixels.

Height Height of output. This is a double value, and specifies height in terms of pixels.

BackColor Variant. Controls color of the background. Specify an OLE_COLOR value. It can be a specific solid color or one of the Windows System Colors such as 'Window Background'. (Most containers like Visual Basic display a special color picker dialog in their property pages for properties of type OLE_COLOR.)

Mapx Referenc 331

Page 346: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.ExportRegionSample method (Style object)

Style.ExportRegionSample method (Style object)

Purpose

Exports the region style sample.

Syntax

OBJECT.ExportRegionSample (Location, Format, Width, Height, [BackColor ])

Example in Visual Basic

'This sample demonstrates the Style.ExportRegionSample

method. It uses

'the method to place a region in the clipboard as a BMP.

Private Sub Command1_Click()

'Export a 120 pixel by 90 pixel region to the clipboard in BMP

'Format

Map1.ExportRegionSample "clipboard", miFormatBMP, 120, _

90, miColorWhite

Part Description

OBJECT Represents a Style object

Location File specification of where to put the output, such as "C:\Temp\Symbol.bmp". If you specify "CLIPBOARD" instead of a file path, the image is put on the clipboard.

Format Output format. This takes an ExportFormatConstants value. Note: If you specify miFormatGIF (to generate GIF files), please read the Licensing Requirements for Users of GIF Files.

Width Width of output. This is a double value, and specifies width in terms of pixels.

Height Height of output. This is a double value, and specifies height in terms of pixels.

BackColor Variant: Controls color of the background. Specify an OLE_COLOR value. It can be a specific solid color or one of the Windows System Colors such as 'Window Background'. (Most containers like Visual Basic display a special color picker dialog in their property pages for properties of type OLE_COLOR.)

332 MapX Reference

Page 347: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.ExportSymbolSample method (Style object)

If Clipboard.GetFormat(vbCFBitmap) Then

Debug.Print "Clipboard contains a BMP"

Else

Debug.Print "Clipboard does not contain a BMP"

End If

End Sub

Style.ExportSymbolSample method (Style object)

Purpose

Exports the symbol style sample.

Syntax

OBJECT.ExportSymbolSample (Location, Format, Width, Height, [BackColor ] )

Example in Visual Basic

'This sample demonstrates the Style.ExportSymbolSample

'method. It uses

'the method to place a symbol in the clipboard as a BMP.

Private Sub Command1_Click()

'Export a 12 pixel by 9 pixel symbol to the clipboard in BMP _

'Format

Part Description

OBJECT Represents a Style object

Location File specification of where to put the output, such as "C:\Temp\Symbol.bmp". If you specify "CLIPBOARD" instead of a file path, the image is put on the clipboard.

Format Output format. This takes an ExportFormatConstants value. Note: If you specify miFormatGIF (to generate GIF files), please read the Licensing Requirements for Users of GIF Files.

Width Width of output. This is a double value, and specifies width in terms of pixels.

Height Height of output. This is a double value, and specifies height in terms of pixels.

BackColor Variant. Controls color of the background. Specify an OLE_COLOR value. It can be a specific solid color or one of the Windows System Colors such as 'Window Background'. (Most containers like Visual Basic display a special color picker dialog in their property pages for properties of type OLE_COLOR.)

Mapx Referenc 333

Page 348: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.ExportTextSample method (Style object)

Map1.ExportSymbolSample "clipboard", miFormatBMP,

12, 9, miColorWhite

If Clipboard.GetFormat(vbCFBitmap) Then

Debug.Print "Clipboard contains a BMP"

Else

Debug.Print "Clipboard does not contain a BMP"

End If

End Sub

Style.ExportTextSample method (Style object)

Purpose

Exports the text style sample.

Syntax

OBJECT.ExportTextSample (Location, Format, Width, Height, [BackColor ])

Example in Visual Basic

'This sample demonstrates the Style.ExportTextSample method.

'It uses the method to place text in the clipboard as a BMP.

Part Description

OBJECT Represents a Style object

Location File specification of where to put the output, such as "C:\Temp\Symbol.bmp". If you specify "CLIPBOARD" instead of a file path, the image is put on the clipboard.

Format Output format. This takes an ExportFormatConstants value. Note: If you specify miFormatGIF (to generate GIF files), please read the Licensing Requirements for Users of GIF Files.

Width Width of text output. This is a double value, and specifies width in terms of pixels.

Height Height of text output. This is a double value, and specifies height in terms of pixels.

SampleText String. The sample text to export.

BackColor Variant. Controls color of the background. Specify an OLE_COLOR value. It can be a specific solid color or one of the Windows System Colors such as 'Window Background'. (Most containers like Visual Basic display a special color picker dialog in their property pages for properties of type OLE_COLOR.)

334 MapX Reference

Page 349: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.LineColor property (Style object)

Private Sub Command1_Click()

'Export a 2 pixel by 9 pixel text to the clipboard in BMP Format

Map1. ExportTextSample "clipboard", miFormatBMP, 2, 9, _ "Hello World", miColorWhite

If Clipboard.GetFormat(vbCFBitmap) Then

Debug.Print "Clipboard contains a BMP"

Else

Debug.Print "Clipboard does not contain a BMP"

End If

End Sub

Style.LineColor property (Style object)

Purpose

Contains the line color. Used for linear objects. This is an OLE_COLOR value.

Style.LineInterleaved property (Style object)

Purpose

A read-write boolean property. It is used to make a pen style interleaved if that pen style supports being interleaved with the LineSupportsInterleave property. An interleaved pen style can create the appearance of intersections on your maps for overlapping intersections and lines.

Example in Visual Basic

Private Sub btnTestInterleave_Click()

Dim lyr As MapXLib.Layer

Dim Style As MapXLib.Style

Dim sPat As Single

Set lyr = Map1.Layers.Add("us_hiway.tab", 1)

lyr.Style.LineStyle = 63

' If the pen style supports being interleaved, then

' turn interleaving on.

If (lyr.Style.LineSupportsInterleave) Then

lyr.Style.LineInterleaved = True

Mapx Referenc 335

Page 350: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.LineInterleaved property (Style object)

End If

Set Style = lyr.Style

Style.LineWidthUnit = miStyleUnitTenthsOfPoint

' Set the line width to .5 points

Style.LineWidth = 5

Style.RegionBorderWidthUnit = miStyleUnitPixe

'Set the region border width to 3 pixels

Style.RegionBorderWidth = 3

End Sub

Example in C++

void CSampleProjectView::TestInterleave() {

CMapXLayer lyr;

CMapXStyle Style;

try {

lyr = m_Map.GetLayers().Add("us_hiway.tab",1);

lyr.GetStyle().SetLineStyle(63);

// If the line style supports interleaving, turn

interleaving on

if(lyr.GetStyle().GetLineSupportsInterleave() == TRUE)

lyr.GetStyle().SetLineInterleaved(TRUE);

Style = lyr.GetStyle();

Style.SetLineWidthUnit(miStyleUnitTenthsOfPoint);

// Set the line width to .5 points

Style.SetLineWidth(5);

Style.SetRegionBorderWidthUnit(miStyleUnitPixel);

// Set the region border width to 3 pixels

Style.SetRegionBorderWidth(3);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

336 MapX Reference

Page 351: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.LineStyle property (Style object)

e->Delete();

}

}

Style.LineStyle property (Style object)

Purpose

Returns or sets a line style number (solid, dashed, etc.); used to display linear features.

Remarks

This property is a read-write integer line style number: 0 represents a non–visible line, 1 a solid line, and a larger number for a patterned line; see table below.

You can assign any PenStyleConstants value to this property. However, most of the line styles do not have corresponding constants. The table below shows the complete set of LineStyle numbers.

Mapx Referenc 337

Page 352: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.LineStyleCount property (Style object)

Note: The table (above) shows the default styles. If the user has customized the mapx.pen file (the file that defines the line styles), the set of available styles might not match the table shown above. Use the LineStyleCount property to determine the number of styles in the .pen file.

See Also

PenStyleConstants

Style.LineStyleCount property (Style object)

Purpose

A read-only integer value, indicating the number of line styles that are available. The count includes pen styles read in from the mapx.pen file.

Style.LineSupportsInterleave property (Style object)

Purpose

A read-only boolean property. Denotes whether a given pen style supports interleave or not.

See Also

Style.LineInterleaved

Style.LineWidth property (Style object)

Purpose

Contains the width of a line in pixels. Used for linear objects. This is an Integer value.

Style.LineWidthUnit property (Style object)

Purpose

Controls the unit of measurement for the line width. The width is specified in either pixels or tenths of points, by specifying a StyleUnitConstants value.

See Also

Style.LineWidth

338 MapX Reference

Page 353: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.PickLine method (Style object)

Style.PickLine method (Style object)

Purpose

Displays the Line Style Picker dialog that allows a user to choose line style properties. The Style object is updated with the new properties if the user clicks OK in the dialog.

Syntax

OBJECT.PickLine

Style.PickRegion method (Style object)

Purpose

Displays the Region Style Picker dialog that allows a user to choose region style properties. The Style object is updated with the new properties if the user clicks OK in the dialog.

Syntax

OBJECT PickRegion

Style.PickSymbol method (Style object)

Purpose

Displays the Symbol Style Picker dialog that allows a user to choose symbol style properties. The style object is updated with the new properties if the user clicks OK in the dialog.

Syntax

OBJECT.PickSymbol

Style.PickText method (Style object)

Purpose

Displays the Text Style Picker dialog that allows a user to choose text style properties. The style object is updated with the new properties if the user clicks OK in the dialog.

Syntax

OBJECT.PickText

Mapx Referenc 339

Page 354: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.RegionBackColor property (Style object)

Style.RegionBackColor property (Style object)

Purpose

Contains the region background color. This is used when a RegionPattern other than miPatternSolid is specified for region objects. This is an OLE_COLOR value.

See Also

FillPatternConstants

Style.RegionBorderColor property (Style object)

Purpose

Contains the region border color. Used for region objects. This is an OLE_COLOR value.

Style.RegionBorderStyle property (Style object)

Purpose

Contains the line style for a region border. Used for region objects. This takes a PenStyleConstants value.

See Also

PenStyleConstants

Style.RegionBorderWidth property (Style object)

Purpose

Contains the width of a region border. Used for region objects. This is an Integer value, and width is specified in pixels.

Style.RegionBorderWidthUnit property (Style object)

Purpose

Controls the unit of measurement for the region border width. The width is specified in either pixels or tenths of points, by specifying a StyleUnitConstants value.

See Also

Style.RegionBorderWidth

340 MapX Reference

Page 355: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.RegionColor property (Style object)

Style.RegionColor property (Style object)

Purpose

Contains the region color. Used for region objects. This is an OLE_COLOR value.

Style.RegionPattern property (Style object)

Purpose

Contains the region pattern. Used for region objects. This takes a FillPatternConstants value.

See Also

FillPatternConstants

Style.RegionTransparent property (Style object)

Purpose

A read-write boolean value, indicating whether a region drawn with a pattern is transparent. A value of True makes the region transparent, while False makes it opaque.

Remarks

If a region feature is drawn with a fill pattern (as opposed to a solid fill), you can control whether the fill pattern is transparent. Use a transparent fill style if features on your map overlap, and you want to see what is underneath a region.

The following picture shows two buffer regions. The region on the left is opaque; the region on the right is transparent, allowing you to see features beneath the region.

The RegionTransparent property does not have any effect on regions drawn with a solid fill.

Mapx Referenc 341

Page 356: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.SupportsBitmapSymbols property (Style object)

Style.SupportsBitmapSymbols property (Style object)

Purpose

A read-only boolean value, indicating whether the style object supports bitmap symbols.

Remarks

A True value indicates that the Symbol object supports bitmap symbols.

Currently, only Feature, Layer, and Theme objects support bitmap symbols.

See Also

Bitmap Symbols

Style.SymbolBitmapColor property (Style object)

Purpose

A read-write OLE_COLOR value, used to override the non-white pixels in a bitmap symbol.

Remarks

To make the non-white pixels in a bitmap symbol appear in a particular color:

1. Set the SymbolBitmapColor property to the desired color

2. Set the SymbolBitmapOverrideColor property to True.

When you change a TrueType font symbol into a bitmap symbol - in other words, when you change the SymbolType property to miSymbolTypeBitmap (1) - MapX sets the SymbolBitmapColor property to match the SymbolFontColor property.

See Also

Bitmap Symbols

Style.SymbolBitmapName property (Style object)

Purpose

A read-write string value, representing the name of the bitmap file to use as a bitmap symbol.

Remarks

The name that you specify should not include a full directory path. The bitmap file must be in the custom symbol directory, currently defined to be:

<path>\CUSTSYMB

where <path> is the path to mitmdl30.dll.

342 MapX Reference

Page 357: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.SymbolBitmapOverrideColor property (Style object)

See Also

Bitmap Symbols

Style.SymbolBitmapOverrideColor property (Style object)

Purpose

A read-write boolean value, indicating whether the non-white pixels in a bitmap symbol are drawn in an override color.

Remarks

The default is false, meaning that the non–white pixels in a bitmap symbol will appear in their default colors. If you want all of the non–white pixels to display in an override color (the color specified by the SymbolBitmapColor property), set this property to True.

See Also

Bitmap Symbols

Style.SymbolBitmapSize property (Style object)

Purpose

A read-write integer value, indicating the size of the symbol, in points. 72 points is equivalent to 1 inch.

Remarks

When you change a TrueType font symbol into a bitmap symbol - in other words, when you change the SymbolType property to miSymbolTypeBitmap (1) - MapX sets the SymbolBitmapSize property to match the value of the SymbolFont.Size property. For example, if you change a 12-point TrueType font symbol into a bitmap symbol, the SymbolBitmapSize will be 12.

See Also

Bitmap Symbols

Mapx Referenc 343

Page 358: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.SymbolBitmapTransparent property (Style object)

Style.SymbolBitmapTransparent property (Style object)

Purpose

A read-write boolean value, indicating whether the white portion of a bitmap symbol is drawn as transparent.

Remarks

Default value is False, meaning that the white portion of a bitmap symbol will appear white. Set to True if you want white portions of the bitmap to be transparent.

See Also

Bitmap Symbols

Style.SymbolCharacter property (Style object)

Purpose

Specifies which symbol to use. Used for symbol objects. This takes an Integer value between 0 and 255, and represents the ASCII code of the character in the TrueType font set to use.

See Also

Style.SymbolFont

Style.SymbolFont property (Style object)

Purpose

Returns a standard Font object (IFontDispatch, OLE_FONT) which allows you to set font properties (Bold, Size, etc.) to alter a symbol's appearance and can only apply to TrueType font symbols..

Remarks

A symbol can be defined by the combination of a TrueType font and a character within that font (Style.SymbolCharacter). Therefore, if you need to modify the appearance of a symbol, you might need to obtain and modify the symbol's Style.SymbolFont property

The SymbolFont property is read-only; however, you can set the properties of the Font object that it returns.

See Also

Style.SymbolCharacter property

Setting Font Attributes

344 MapX Reference

Page 359: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.SymbolFontBackColor property (Style object)

Example

The following example uses the Style.SymbolFont property to retrieve a Font object, and then sets the Font object's Size property to 36 pt. The new symbol style is used to override the appearance of the layer

Map1.Layers(1).OverrideStyle = True

Map1.Layers(1).Style.SymbolFont.Size = 36

Style.SymbolFontBackColor property (Style object)

Purpose

Contains the symbol background color. Used for symbol objects and can only apply to TrueType font symbols.. This is an OLE_COLOR value.

Style.SymbolFontColor property (Style object)

Purpose

Contains the symbol color. Used for symbol objects and can only apply to TrueType font symbols. This is an OLE_COLOR value.

Style.SymbolFontHalo property (Style object)

Purpose

This read/write property controls whether a halo is drawn around the symbol. Used for symbol objects and can only apply to TrueType font symbols. A halo is a `buffer' around the symbol - to help offset it from the map beneath. This is a Boolean value that one can set to true for individual features.

Style.SymbolFontOpaque property (Style object)

Purpose

This read/write property controls whether the symbol displays a background color (and is thus opaque). Used for symbol objects and can only apply to TrueType font symbols. This is a Boolean value.

Mapx Referenc 345

Page 360: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.SymbolFontRotation property (Style object)

Style.SymbolFontRotation property (Style object)

Purpose

Read-write integer value, indicating the number of degrees to rotate a TrueType symbol.

Remarks

This property should be set to an integer between zero and 360. Rotation is clockwise.

This property only applies to TrueType font symbols, not to bitmap symbols; bitmap symbols cannot be rotated.

Feature, Layer, and Theme objects support rotated symbols. If an object does not support rotated symbols, this property is ignored.

Style.SymbolFontShadow property (Style object)

Purpose

Applies only to Layer Styles and Label Styles. Controls whether a shadow is drawn under the symbol. Used for symbol objects and can only apply to true type font symbols. This is a Boolean value.

Style.MinVectorSymbolCharacter property (Style object)

Purpose

This property applies to Symbol Style objects. It is a read-only integer property which contains the minimum value of Style.SymbolCharacter which will yield a Vector symbol. For these symbols, the Style.SymbolType should be set to miSymbolTypeVector.

Style.MaxVectorSymbolCharacter property (Style object)

Purpose

This property applies to Symbol Style objects. It is a read-only integer property which contains the maximum value of Style.SymbolCharacter which will yield a vector symbol. For these symbols, the Style.SymbolType should be set to miSymbolTypeVector.

346 MapX Reference

Page 361: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.SymbolVectorColor property (Style object)

Style.SymbolVectorColor property (Style object)

Purpose

This property applies to vector symbol Style objects. It is a read-write OLE_COLOR value which specifies the color of the vector symbol. The default is miColorBlack.

Style.SymbolVectorSize property (Style object)

Purpose

This property applies to vector symbol Style objects. It is a read-write Integer value which specifies the point size of the vector symbol. The default is 12.

Style.TextFont property (Style object)

Purpose

Returns a standard Font object (IFontDispatch, OLE_FONT) which allows you to set font properties (Bold, Size, etc.) to alter the appearance of text features.

Remarks

The TextFont property is read-only; however, you can set the properties of the Font object that it returns.

Style.TextFontAllCaps property (Style object)

Purpose

Applies only to Layer Styles and Label Styles. Controls whether the text is displayed in all capital letters. Used for text objects. This is a Boolean value.

Style.TextFontBackColor property (Style object)

Purpose

Contains the text background color. Used for text objects. This is an OLE_COLOR value.

See Also

OLE_Color Values

Mapx Referenc 347

Page 362: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.TextFontColor property (Style object)

Style.TextFontColor property (Style object)

Purpose

Contains the text color. Used for text objects. This is an OLE_COLOR value.

See Also

OLE_Color Values

Style.TextFontDblSpace property (Style object)

Purpose

Applies only to Layer Styles and Label Styles. Controls whether the text is displayed using large spacing between the letters. Used for text objects. This is a Boolean value.

Style.TextFontHalo property (Style object)

Purpose

Applies only to Layer Styles and Label Styles. Controls whether a halo is drawn around the text. This is used for text objects. A halo is a `buffer' around the text - to help offset it from the map beneat. This is a Boolean value.

Style.TextFontOpaque property (Style object)

Purpose

Controls whether the text displays a background color (and is thus opaque). This is used for text objects and is a Boolean value.

Style.TextFontShadow property (Style object)

Purpose

Applies only to Layer Styles and Label Styles. Controls whether a shadow is drawn under the text. This is used for text objects and is a Boolean value.

Style.TextFontRotation property (Style object)

Pourpose

Indicates the number of degrees to rotate (clockwise) a Text object. Valid values are 0 <= x <= 360.

348 MapX Reference

Page 363: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.SymbolType property (Style object)

Currently valid only for Feature objects. If set/queried for any object other that a Feature object, this property is ignored/undefined.

Style.SymbolType property (Style object)

Purpose

A read-write short value, indicating how to display a point feature (as a character from a TrueType font, a bitmap, or a VectorSymbol). It should be set to one of the SymbolTypeConstants.

Remarks

To use a TrueType font symbol, set this to miSymbolTypeTrueTypeFont.

To change to a bitmap symbol, set this to miSymbolTypeBitmap.

To change to a vector symbol, set this to miSymbolTypeVector.

Note: Only some objects (Feature, Layer, Theme) support bitmap symbols. Attempting to set SymbolType to miSymbolTypeBitmap will throw an exception if the object does not support bitmap symbols.

See Also

Bitmap Symbols

Mapx Referenc 349

Page 364: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Style.SymbolType property (Style object)

350 MapX Reference

Page 365: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Theme object and Themes collection

Theme objects contain the attributes of a theme.

Each DataSet has a collection of Themes (DataSet.Themes). The Theme collection has methods and properties used to add and remove Theme objects from the collection.

Object Properties• Theme.AutoReCompute property • Theme.ComputeTheme property • Theme.DataMax property• Theme.DataMin property • Theme.Fields property • Theme.Layer property • Theme.Legend property • Theme.Name property • Theme.ThemeProperties property • Theme.Type property • Theme.Visible property

Object Methods• Theme.ThemeDlg method

Collection Properties• Themes.Count property • Themes.Item property

Collection Methods• Themes.Add method • Themes.Remove method • Themes.RemoveAll method

Theme.AutoReCompute property (Theme object)

Purpose

Controls when theme ranges are recomputed. This is a Boolean property, and defaults to TRUE.

Page 366: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Theme.ComputeTheme property (Theme object)

Discussion

When theme properties are changed (such as ThemeProperties.NumRanges), the Theme object is recomputed. This can take some time. If you want to change several properties, you should set AutoReCompute to FALSE, change the properties, then set AutoRecompute to TRUE, and have the recomputation happen only once.

Theme.ComputeTheme property (Theme object)

Purpose

Controls whether themes are computed from the data on the table. This is a Boolean property, and defaults to True. A True value will calculate the theme from the raw data.

If the value is set to False an invisible theme object will be created with 10 ranges for Individual value themes and 5 ranges for Ranged themes. You can then manually set the minimum and maximum values to define the theme with Theme.DataMin and Theme.DataMax. ThemeProperties.NumRanges and IndividualValueCategory.Value properties are used to modify it.

For range themes you can manually set the theme ranges or calculate equal size ranges determined by the minimum (Theme.DataMin) and maximum (Theme.DataMax) values.

See Also

Theme.DataMax property

Theme.DataMin property

IndividualValueCategory.Value

Theme.DataMax property (Theme object)

Purpose

Determines the maximum value to set the theme ranges or calculate equal size ranges for range themes when the Theme.ComputeTheme property or the ComputeTheme parameter of the Themes.Add method is set to FALSE.

See Also

Theme.ComputeTheme

Theme.DataMin

352 MapX Reference

Page 367: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Theme.DataMin property (Theme object)

Theme.DataMin property (Theme object)

Purpose

Determines the minimum value to set the theme ranges or calculate equal size ranges for range themes when the Theme.ComputeTheme property or the ComputeTheme parameter of the Themes.Add method is set to FALSE.

See Also

Theme.ComputeTheme

Theme.DataMax

Theme.Fields property (Theme object)

Purpose

Returns a read-only Fields collection, representing the set of fields used by the dataset that this theme is based on.

Theme.Layer property (Theme object)

Purpose

Read-only property that returns a Layer object, representing the layer that the theme is based on.

Theme.Legend property (Theme object)

Purpose

Each Theme object has a Legend object (Theme.Legend). The Legend object contains properties to control the display of a theme's legend. Each ThemeCategory object (RangeCategory, IndividualValueCategory, or MultiVarCategory) has an entry in the legend contained in a LegendText object.

See Also

Legend object

Mapx Referenc 353

Page 368: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Theme.Name property (Theme object)

Theme.Name property (Theme object)

Purpose

The name of the Theme must be unique within a Themes collection. This is a read/write property, and is either specified as a parameter to the Themes.Add method or generated by MapX when the theme is created. This is the default property for the Theme object.

Remarks

The Name property can be used with the Themes.Item property and the Themes.Remove method.

See Also

Themes.Add method

Themes.Item property

Themes.Remove method

Theme.ThemeDlg method (Theme object)

Purpose

Brings up a stock dialog that allows the user to manipulate the style of the Theme. The particular dialog brought up will match the type of the Theme object (Range, Dot Density, Pie, BarIndividualValues, or Graduated Symbol). If the user clicks 'OK', the changes made within the dialog will immediately be applied to the theme on the map.

Syntax

[Boolean=]OBJECT.ThemeDlg ([HelpFile], [HelpID])

Remarks

If either of the optional parameters are not given, the help button will not appear on the dialog.

The return value of ThemeDlg is True if the user clicked OK and False if the user clicked Cancel.

Parts Description

OBJECT Represents a Theme object.

HelpFile HelpFile is an optional parameter that is a pathname to a .hlp file that contains help topics for the dialog.

HelpID HelpID is an optional parameter that refers to the ID of a specific help topic within the given .hlp file.

354 MapX Reference

Page 369: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Theme.ThemeProperties property (Theme object)

Example in Visual Basic

` This example displays the Theme Dialog for a theme when its

` legend is double-clicked on.

Private Sub Map1_ThemeModifyRequested(ByVal Theme As Object)

Theme.ThemeDlg

End Sub

Example in C++

void CSampleProjectView::OnThemeModifyRequested(LPDISPATCH ThemeDispatch) {

// Display the Theme dialog for a theme when its legend

// is double clicked on

CMapXTheme theme;

theme.AttachDispatch(ThemeDispatch,FALSE);

try {

theme.ThemeDlg();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Theme.ThemeProperties property (Theme object)

Purpose

An object containing properties about the theme. The set of properties contained in the ThemeProperties object is determined by the type of the Theme object (type of thematic map).

See Also

ThemeProperties object

Mapx Referenc 355

Page 370: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Theme.Type property (Theme object)

Theme.Type property (Theme object)

Purpose

The type of theme for a Theme object. This is a ThemeTypeConstants value and is a Read-only property

See Also

ThemeTypeConstants

Theme.Visible property (Theme object)

Purpose

Sets whether or not the theme is visible. This is a Boolean value, and defaults to TRUE.

Themes.Add method (Themes collection)

Purpose

Creates a theme and adds it to the Themes collection for a particular dataset.

Remarks

When creating a theme, computing ranges for layers with large numbers of rows, such as drilldown or server layers, can take some time. The ComputeTheme parameter lets you create a non-compute theme for any theme type. A non-compute theme gives you the ability to create a theme without having the ranges automatically calculated for you. You can then create the ranges yourself. This is a faster way for drilldown and server layers.

Note: MapX will create an empty theme against an empty dataset. A theme object is created and added to the themes collection, but because the theme is based on a dataset with no data, the theme will not be visible.

A dataset with no rows would probably only occur if there is a programmer error. For instance, if one accidentally binds USA data against the Canada layer, the result is a dataset with no rows (i.e. no data). If one tries to make a theme based on that dataset, an "empty" theme is created. The onus of checking whether there are any rows in the dataset before making a theme, is on the progammer.

356 MapX Reference

Page 371: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Themes.Add method (Themes collection)

Syntax

OBJECT.Add ([Type], [Field], [Name], [ComputeTheme])

Example of a Compute Theme in Visual Basic

'This example assumes we have a dataset object "ds"

'containing the fields in the cols array.

'Add a ranged theme:

ds.Themes.Add miThemeRanged, "TOTPOPCUR", "My Ranged Theme"

Part Description

OBJECT Represents a Themes object.

Type Specifies the type of thematic map to create. This takes a ThemeTypeConstants value. This is an optional parameter, and if not specified (or specified as miThemeAuto), MapX will attempt to choose a good default based on the number of fields passed in as well as what other theme types are already being displayed. If MapX cannot choose a default theme type, an error is generated.

Field(s) Specifies the field or fields to thematically map. A field can be specified by name, index, or by a Field object. If you are creating a theme using multiple variables (such as a bar chart or pie chart), pass in a Fields collection or an array of field names, indexes, or Field objects. This is an optional parameter, and if not specified, MapX uses the first numeric field of the DataSet.

Name Specifies the name of the thematic map. This is a String parameter. This is an optional parameter, and if not specified, MapX generates a name such as StatesBySales.

ComputeTheme Boolean. The default value is True which will calculate the theme from the table data. If the value is set to False an invisible theme object will be created with 10 ranges for IndividualValue themes and 5 ranges for Ranged themes. You can then manually set the minimum and maximum values to define the theme with Theme.DataMin and Theme.DataMax. For range themes you can manually set the theme ranges or calculate equal size ranges determined by the minimum (Theme.DataMin) and maximum (Theme.DataMax) values.

Mapx Referenc 357

Page 372: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Themes.Add method (Themes collection)

'Add a Bar Chart theme:

dim cols(1 to 3) as string

cols(1) = "TOTPOPHIS"

cols(2) = "TOTPOPCUR"

cols(3) = "TOTPOPPRO"

ds.Themes.Add miThemeBarChart, cols, "My Bar Theme"

Example in C++

void CSampleProjectView::ThemesAdd(CMapXDataset& ds) {

try {

// Add a ranged theme

ds.GetThemes().Add(miThemeRanged,"TOTPOPCUR","My Ranged Theme");

m_Map.Refresh();

// Create the array of strings

SAFEARRAY FAR* psa=NULL;

SAFEARRAYBOUND rgsabound[1];

LONG i;

CString str1("TOTPOPHIS"), str2("TOTPOPCUR"),str3("TOTPOPPRO");

COleVariant Field;

rgsabound[0].lLbound = 1;

rgsabound[0].cElements = 3;

psa = SafeArrayCreate(VT_BSTR, 1, rgsabound);

if(psa == NULL){

return;

}

i=1;

SafeArrayPutElement(psa,&i,str1.AllocSysString());

i=2;

SafeArrayPutElement(psa,&i,str2.AllocSysString());

i=3;

SafeArrayPutElement(psa,&i,str3.AllocSysString());

// put array in field param

Field.vt = VT_ARRAY | VT_BSTR;

Field.parray = psa;

358 MapX Reference

Page 373: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Themes.Add method (Themes collection)

// Add a bar chart theme

ds.GetThemes().Add(COleVariant((long)miThemeBarChart),Field,COleVariant("My Bar Theme"));

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Example of a Non-Compute Theme in Visual Basic

Dim ds As MapXLib.Dataset

Dim parm As New ODBCQueryInfo

parm.SqlQuery = "select * from usa"

parm.DataSource = "mapstats" ' name of odbc datasourc

parm.ConnectString = "ODBC;" ' can be left blank

Set ds = Map1.Datasets.Add(miDataSetODBC, parm, "odbc Dataset",, , , , True)

ds.Themes.Add , , , False

ds.Themes(1).AutoRecompute = False

ds.Themes(1).ThemeProperties.DistMethod = miEqualRangeSize

ds.Themes(1).DataMin = 0

ds.Themes(1).DataMax = 32000000

ds.Themes(1).ThemeProperties.NumRanges = 10

ds.Themes(1).AutoRecompute = True

ds.Themes(1).Visible = True

See Also

Field object

ThemeTypeConstants

Theme.DataMax property

Theme.DataMin property

Theme.Name property

Theme.Type property

Mapx Referenc 359

Page 374: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Themes.Count property (Themes collection)

Themes.Count property (Themes collection)

Purpose

The number of Theme objects in a Themes collection. This is a read-only property.

Example in Visual Basic

Dim iThmCount as Integer

iThmCount = Map.Datasets(1).Themes.Count

Debug.Print "There are " & iThmCount & " Themes attached to _

dataset" & Map.Datasets(1).Name

Example in C++

void CSampleProjectView::PrintNumThemes() {

long thmCount;

CString msg;

try {

thmCount = m_Map.GetDatasets().Item(1).GetThemes().GetCount();

msg.Format("There are %d Themes attached to dataset %s",thmCount,m_Map.GetDatasets().Item(1).GetName());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

AfxMessageBox(msg);

}

Themes.Item property (Themes collection)

Purpose

Retrieve a Theme object from the Themes collection. This takes a parameter to specify which theme. The parameter is a Variant representing the 1 based index number, or the theme name. This is the default property for the Themes collection.

360 MapX Reference

Page 375: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Themes.Remove method (Themes collection)

Syntax

OBJECT.Item (index)

See Also

Theme.Name property

Themes.Remove method (Themes collection)

Purpose

Removes the specified Theme object from the Themes collection.

Note: If you remove an item, the collection indexes are renumbered to fill in the hole left by the item removed.

Syntax

OBJECT.Remove (index)

Example

Map.Datasets(1).Themes.Remove "My DD Theme"

- or -

Map.Datasets(1).Themes.Remove 1

See Also

Theme.Name property

Part Description

OBJECT Represents a Themes object.

index Theme object 1–based index number or theme name.

Part Description

OBJECT Represents a Themes object.

index Theme object 1 based index number or theme name.

Mapx Referenc 361

Page 376: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Themes.RemoveAll method (Themes collection)

Themes.RemoveAll method (Themes collection)

Purpose

Removes all Theme objects from the collection.

Syntax

OBJECT.RemoveAll

Example in Visual Basic

Private Sub btnThemesRemoveAll_Click()

Dim nThemes As Integer

Dim ds As Dataset

Set ds = Map1.Datasets.Add(miDataSetLayer, Map1.Layers(1))

' add a default theme

ds.Themes.Add

nThemes = ds.Themes.Count

' remove all of the themes

ds.Themes.RemoveAll

nThemes = ds.Themes.Count

End Sub

Example in C++

void CSampleProjectView::RemoveAllThemes() {

CMapXDataset ds;

CMapXLayer Layer;

COleVariant LayerVariant;

try {

Layer = m_Map.GetLayers().Item(1);

LayerVariant.vt = VT_DISPATCH

LayerVariant.pdispVal = Layer.m_lpDispatch;

LayerVariant.pdispVal->AddRef();

ds=m_Map.GetDatasets().Add(miDataSetLayer,LayerVariant);

// add a default theme

ds.GetThemes().Add();ds.GetThemes().RemoveAll();

} catch (COleDispatchException *e) {e->ReportError();e->Delete();

} catch (COleException *e) {e->ReportError();e->Delete();

}

}

362 MapX Reference

Page 377: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeProperties object

The ThemeProperties object is a property of a Theme object and contains the information defining the Theme.

Note: The Theme.Properties property still works as it did before, but it is recommended that you use the ThemeProperties object because of its improved functionality.

Object Properties• ThemeProperties.AllowEmptyRanges property • ThemeProperties.ApplyAttribute property • ThemeProperties.BarFrame property • ThemeProperties.BarFramedStyle property • ThemeProperties.BarGraduatedStack property • ThemeProperties.BarIndependentScale property • ThemeProperties.BarStacked property • ThemeProperties.BarWidth property • ThemeProperties.BorderStyle property • ThemeProperties.ColorMethod property • ThemeProperties.DataValue property • ThemeProperties.DistMethod property • ThemeProperties.DotColor property • ThemeProperties.DotSize property • ThemeProperties.Graduated property • ThemeProperties.GraduateSizeBy property • ThemeProperties.Independent property • ThemeProperties.IndividualValueCategories property • ThemeProperties.InflectionColor property • ThemeProperties.InflectionRange property • ThemeProperties.InflectRanges property • ThemeProperties.MultivarCategories property • ThemeProperties.NegativeSymbolStyle property • ThemeProperties.NumRanges property • ThemeProperties.PieClockwise property • ThemeProperties.PieGraduated property • ThemeProperties.PieHalfPies property • ThemeProperties.PieStartAngle property • ThemeProperties.PositiveSymbolStyle property • ThemeProperties.RangeCategories property • ThemeProperties.RoundBy property • ThemeProperties.RoundRanges property • ThemeProperties.ShowNegativeValues property

Page 378: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeProperties.AllowEmptyRanges property (ThemeProperties object)

• ThemeProperties.Size property • ThemeProperties.SpreadBy property • ThemeProperties.SymbolStyle property • ThemeProperties.ValuePerDot property • ThemeProperties.Width property

ThemeProperties.AllowEmptyRanges property (ThemeProperties object)

Purpose

Read/write Boolean property; controls whether empty ranges are allowed in a ranged theme. The default is False for a new theme, meaning that empty ranges are not allowed in a ranged theme.

Remarks

If the ThemeProperties.DistMethod property is set to miCustomRanges (value: 0), empty ranges are allowed, regardless of the value of the AllowEmptyRanges property.

See Also

Legend.ShowEmptyRanges

ThemeProperties.DataValue property (ThemeProperties object)

Purpose

Applies to GraduatedSymbol, Pie, and Bar themes. Works in conjunction with the Size property to control how big the thematic graphics are at particular values. This is a Double value, and is the value at which the thematic graphic is drawn at the size specified by the Size property. The default value for this property is set to the largest data value of the mapped features.

See Also

ThemeProperties.Size property

364 MapX Reference

Page 379: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeProperties.DistMethod property (ThemeProperties object)

ThemeProperties.DistMethod property (ThemeProperties object)

Purpose

This property applies to Ranged themes. It controls how ranges (in the RangeCategories collection) are created when a Theme object is recomputed. This property takes a DistribMethodConstants value and defaults to miEqualCountPerRange. The available distribution types are as follows:

See Also

RangeCategories collection

ThemeProperties.DotSize property (ThemeProperties object)

Purpose

This property applies to DotDensity themes. This controls the dot size used by DotDensity thematic maps. This is a DotSizeConstants value and defaults to miDotSizeSmall.

ThemeProperties.Graduated property (ThemeProperties object)

Purpose

This property applies to Pie themes. This controls whether the size of the Pie charts are graduated based on the total value of the Pie. This is a Boolean value, and defaults to TRUE.

Distribution Description

miEqualRangeSize Takes the maximum data value and the minimum data value, andchooses ranges by breaking the range of data values into equally sized pieces (e.g. 0-25; 25-50; 51-75; 76-100)

miEqualCountPerRange Attempts to assign ranges in such a way that each range contains the same number of features.

miCustomRanges You will specify your own ranges in the RangeCategories collection (and MapX won't compute ranges).

miNaturalBreak Range breaks are determined using an algorithm that attempts to minimize the difference between the data values and the average of the data values, minimized on a per range basis

miStandardDeviation The middle range breaks at the mean of the data values, and the ranges above and below the middle range are one standard deviation above or below the mean.

Mapx Referenc 365

Page 380: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeProperties.Independent property (ThemeProperties object)

See Also

ThemeProperties.PieGraduated

ThemeProperties.Independent property (ThemeProperties object)

Purpose

This property applies to Bar themes. This controls whether the data values for the bars should be treated independently (not comparable values such as Population and AvgIncome). This is a Boolean value, and the default is FALSE. The developer should set this to true for multi-value Bar themes where the data for each bar of a single feature is unrelated to a bar for a different field of the theme or the maximum values for a field of data differ greatly. An example of this would be a population bar theme where one bar may represent the population of a state and another may be a ranking in exports. The population data would be in the millions and the ranking would only be between 1 and 50. If the Independent property is set to True, then the highest populated state's population bar would be equal in height to the highest ranking state in exports export bar. Were the Independent property left false, the export ranking bar would be difficult to obtain any meaning from because the state ranked 1st would have an export bar the size of a state's population bar if that state had 1 person in it.

Note: BarIndependentScale is now the prefered name for this property

See Also

ThemeProperties.BarIndependentScale property

ThemeProperties.IndividualValueCategories property (ThemeProperties object)

Purpose

Returns an IndividualValueCategories collection; used with Individual Value thematic maps.

ThemeProperties.MultivarCategories property (ThemeProperties object)

Purpose

Returns a MultivarCategories collection; used with thematic maps that use multiple variables (bar or pie charts).

366 MapX Reference

Page 381: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeProperties.NumRanges property (ThemeProperties object)

ThemeProperties.NumRanges property (ThemeProperties object)

Purpose

This property applies to Ranged themes. It controls the number of ranges for a ranged thematic map. This is an Integer value, and defaults to 5.

ThemeProperties.RangeCategories property (ThemeProperties object)

Purpose

Returns a RangeCategories collection; used with ranged thematic maps.

ThemeProperties.Size property (ThemeProperties object)

Purpose

This property applies to Pie and Bar themes. This works in conjunction with the DataValue property to control how big the thematic graphics are at particular values. It specifies the height of the thematic graphic in Paper units (PaperUnit).This is a Double value, and defaults to .25 inches.

See Also

Map.PaperUnit property

ThemeProperties.DataValue property

ThemeProperties.SpreadBy property (ThemeProperties object)

Purpose

Controls how autospreading is done for ranged thematic maps. MapX can compute a set of colors between two colors or compute sizes between two sizes.

Remarks

This takes a SpreadByConstants value. To control which colors or sizes are used for the start or end set the ThemeProperties.RangeCategories(x).Style values, where x = 1 for the first range (start value) and x is ThemeProperties.NumRanges for the last range (end value).

Mapx Referenc 367

Page 382: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeProperties.SymbolStyle property (ThemeProperties object)

ThemeProperties.SymbolStyle property (ThemeProperties object)

Purpose

This property applies to GraduatedSymbol themes. This controls the symbol that is used, as well as the size of the symbol drawn at the value specified by the DataValue property. This is a Style object, and is a read-only property (although the properties of the SymbolStyle are Read/Write).

Note: PositiveSymbolStyle is now the preferred name for this property

See Also

ThemeProperties.PositiveSymbolStyle property

Style object

ThemeProperties.DataValue property

ThemeProperties.ValuePerDot property (ThemeProperties object)

Purpose

This property applies to DotDensity themes. This specifies that value a dot represents. For example, if ValuePerDot was 2000, and a region had a population of 48,000, then 24 dots would be drawn in the region. This is a Double value, and defaults to a reasonable value.

ThemeProperties.Width property (ThemeProperties object)

Purpose

This property applies to Bar themes. It specifies the width of each bar of a Bar theme in Paper units (Map.PaperUnit). This is a Double value, and defaults to .25 inches.

See Also

Map.PaperUnit property

ThemeProperties.PieClockwise property (ThemeProperties object)

Purpose

This is a Boolean property which applies to pie chart themes. It controls the direction that the pie wedges are drawn; if true, they are drawn increasing clockwise. The default is true.

See Also

ThemeProperties.PieStartAngle property

368 MapX Reference

Page 383: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeProperties.PieStartAngle property (ThemeProperties object)

ThemeProperties.PieStartAngle property (ThemeProperties object)

Purpose

This property applies to pie chart themes. It is an Integer property specifying the angle at which the first pie wedge is drawn. It is measured in degrees, increasing counterclockwise, with 0 degrees pointing to the right. The default is 180 degrees.

See Also

ThemeProperties.PieClockwise property

ThemeProperties.PieHalfPies property (ThemeProperties object)

Purpose

This is a Boolean property which applies to pie chart themes. If True, half pies are drawn instead of full pies. The default is False.

ThemeProperties.PieGraduated property (ThemeProperties object)

Purpose

This is a Boolean property which applies to Pie chart themes. It controls whether the size of the pies varies. If True, then the total size of a pie is graduated by its total value. If False, then all pies are the same size. The default is True.

Note: This property replaces ThemeProperties.Graduated. PieGraduated is the perfered name.

See Also

ThemeProperties.GraduateSizeBy property

ThemeProperties.BarStacked property (ThemeProperties object)

Purpose

This is a Boolean property which applies to Bar chart themes. If True, the bars of the chart will be stacked on top of each other; if false, the bars will be side by side. The default is False.

See Also

ThemeProperties.BarGraduatedStack property

Mapx Referenc 369

Page 384: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeProperties.BarGraduatedStack property (ThemeProperties object)

ThemeProperties.BarGraduatedStack property (ThemeProperties object)

Purpose

This Boolean property applies to Bar charts whose ThemeProperties.BarStacked property is True. This controls whether the total size of a bar chart varies. If true, the size of a bar chart will be graduated by the total value of the chart; if false, all of the charts will be the same total size. The default is True.

See Also

ThemeProperties.BarStacked property

ThemeProperties.GraduateSizeBy property

ThemeProperties.BarIndependentScale property (ThemeProperties object)

Purpose

This property applies to Bar themes. It controls whether the data values for the bars should be treated independently (not comparable values such as Population and AvgIncome). This is a Boolean value, and the default is False. The developer should set this to true for multi-value Bar themes where the data for each bar of a single feature is unrelated to a bar for a different field of the theme or the maximum values for a field of data differ greatly. An example of this would be a population bar theme where one bar may represent the population of a state and another may be a ranking in exports. The population data would be in the millions and the ranking would only be between 1 and 50. If the Independent property is set to True, then the highest populated state's population bar would be equal in height to the highest ranking state in exports export bar. Were the Independent property left false, the export ranking bar would be difficult to obtain any meaning from because the state ranked 1st would have an export bar the size of a state's population bar if that state had 1 person in it. This property replaces ThemeProperties.Independent.

ThemeProperties.BarWidth property (ThemeProperties object)

Purpose

This is an Double property which applies to Bar Themes. It specifies the width of each bar of a Bar theme in Paper units (Map.PaperUnit). This is a double value, and defaults to .25 inches. This property replaces the ThemeProperties.Width property

See Also

Map.PaperUnit property

370 MapX Reference

Page 385: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeProperties.BarFramed property (ThemeProperties object)

ThemeProperties.BarFramed property (ThemeProperties object)

Purpose

This boolean property is set to false and specifies whether the bar objects are drawn with frames.

ThemeProperties.BarFrameStyle (ThemeProperties object)

Purpose

This is a Style object which determines the style of the frame of a bar chart.

See Also

Style object

ThemeProperties.BorderStyle property

ThemeProperties.BorderStyle property (ThemeProperties object)

Purpose

This is a Style object which affects Bar chart and Pie chart themes. It controls the line style of the border around a pie or bar chart.

See Also

Style object

ThemeProperties.BarFrameStyle property

ThemeProperties. ShowNegativeValues property (ThemeProperties object)

Purpose

This is a Boolean property which applies to Graduated Symbol themes. If True, then negative data values will be treated like their absolute values; a symbol representing -4000 will have the same size as a symbol representing 4000. If False, then negative values will not be shown. The default is False.

See Also

ThemeProperties.PositiveSymbolStyle property

ThemeProperties.NegativeSymbolStyle property

Mapx Referenc 371

Page 386: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeProperties.PositiveSymbolStyle property (ThemeProperties object)

ThemeProperties.PositiveSymbolStyle property (ThemeProperties object)

Purpose

This property applies to Graduated Symbol themes. This controls the symbol that is used for all positive data values, as well as the size of the symbol drawn at the value specified by the DataValue property. This is a Style object, and is a read/write property (although the properties of the Style object are Read/Write).

Note: This property replaces ThemeProperties.SymbolStyle.

See Also

Style object

ThemeProperties.ShowNegativeValues property

ThemeProperties.NegativeSymbolStyle property

ThemeProperties.DataValue property

ThemeProperties.NegativeSymbolStyle property (ThemeProperties object)

Purpose

This applies to Graduated Symbol themes whose ThemeProperties.ShowNegativeValues property is True. It is a Style object which controls the symbol that is used for all negative data values of the theme. It is a read/write property (although the properties of the Style object are Read/Write).

See Also

Style object

ThemeProperties.ShowNegativeValues property

ThemeProperties.PositiveSymbolStyle property

ThemeProperties.DataValue property

372 MapX Reference

Page 387: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeProperties.GraduateSizeBy property (ThemeProperties object)

ThemeProperties.GraduateSizeBy property (ThemeProperties object)

Purpose

This property applies to Graduated Symbol themes, as well as Pie chart and Bar chart themes which have been set to Graduated. It must be set to a Short value matching one of the GraduationConstants. It controls the relationship between a data value and the size of the corresponding symbol or chart on the map. The default is miGraduateBySquareRoot.

See Also

ThemeProperties.PieGraduated property

ThemeProperties.BarGraduatedStack property

ThemeProperties.DotColor property (ThemeProperties object)

Purpose

This property applies to Dot Density themes. It controls the color of the dots in the theme. It is an OLE_COLOR value.

ThemeProperties.RoundRanges property (ThemeProperties object)

Purpose

This is a Boolean property which applies to Ranged themes. It controls whether the boundaries of the ranges are rounded off. The default is True. The amount that the values are rounded is controlled by the ThemeProperties.RoundBy property.

See Also

ThemeProperties.RoundBy property

ThemeProperties.RoundBy property (ThemeProperties object)

Purpose

This is a Double value which apples to Ranged themes. It specifies the interval to round the ranges to. It only applies when ThemeProperties.RoundRanges is True.

Mapx Referenc 373

Page 388: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeProperties.InflectRanges property (ThemeProperties object)

Remarks

If RoundBy was 100, and the computed ranges were 420-560, and 560-930, then they would be rounded to 400-600, and 600-900, respectively. The default RoundBy value is calculated by finding the power of 10 which is closest to the difference between the maximum and minimum data value. For example, if the difference between the maximum and minimum data value was 11,554, then the default value for the RoundBy property would be 10,000.

See Also

ThemeProperties.RoundRanges property

ThemeProperties.InflectRanges property (ThemeProperties object)

Purpose

This is a Boolean property which applies to Ranged themes. In a ranged theme, an inflection point can be used to separate the data the ranges into two sections. When InflectRanges is true, the colors in the ranged theme will spread from the top range color to the InflectionColor, then from the InflectionColor to the bottom range color. The default is False.

Remarks

For example, if the InflectionColor is miColorWhite, and the top and bottom range colors arblue and red respectively, then the color would go from blue to white, then from white to red. If InflectRanges was False, then the color in the middle ranges would instead be some mixture of blue and red.

See Also

ThemeProperties.InflectionRange property

ThemeProperties.InflectionColor property

ThemeProperties.RangeCategories property

ThemeProperties.InflectionRange property (ThemeProperties object)

Purpose

This is a Short value which applies to Ranged themes. It controls which range takes on the color specified in InflectionColor. The ranges above and below the InflectionRange will have a mixture of InflectionColor and the top and bottom range colors, respectively

374 MapX Reference

Page 389: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeProperties.InflectionColor property (ThemeProperties object)

Remarks

This property only applies if ThemeProperties.InflectRanges is True. The default is 2 (the second range).

See Also

ThemeProperties.InflectRanges property

ThemeProperties.InflectionColor property

ThemeProperties.InflectionColor property (ThemeProperties object)

Purpose

This is an OLE_COLOR value which applies to Ranged themes whose ThemeProperties.InflectRanges is True. It indicates the color of the inflected range. The range that is inflected on is specified in the ThemeProperties.InflectionRange property. The default is miColorWhite.

See Also

ThemeProperties.InflectRanges property

ThemeProperties.InflectionColor property

ThemeProperties.ColorMethod property (ThemeProperties object)

Purpose

This is a Short property which applies to Ranged themes. It should be one of the ColorSpreadingMethodConstants. It specifies the method used to interpolate between the top and bottom range colors to get the colors of the intermediate ranges. It is only valid when ThemeProperties.SpreadB is set to miSpreadByColor.

See Also

ThemeProperties.SpreadBy property

Mapx Referenc 375

Page 390: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeProperties.ApplyAttribute property (ThemeProperties object)

ThemeProperties.ApplyAttribute property (ThemeProperties object)

Purpose

This is a Short property, which should be set to one of the ApplyAttributeConstants. It applies to Ranged or Individual Value themes. It controls which of the theme category's style attributes are actually applied to the theme. It can be used to selectively modify either the color or the size of the categories of the theme, without affecting the other's appearance. The default is miApplyAttributeAll.

See Also

ThemeProperties.RangeCategories property

RangeCategories collection

ThemeProperties.IndividualValueCategories property

IndividualValueCategories collection

376 MapX Reference

Page 391: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Title object

Each map contains a title (Map.Title property) in which the title, its style and location are stored.

Object Properties• Title.Border property • Title.Caption property • Title.Editable property • Title.Position property • Title.TextStyle property • Title.Visible property • Title.X property • Title.Y property

Example in C++

// Title.Editable Property

// Title.Position Property

// Title.X Property

// Title.Y Property

void CSampleProjectView::PositionTitle() {

try {

CMapXTitle MapTitle = m_Map.GetTitle();

// Place the title at the bottom center of the screen

MapTitle.SetEditable(FALSE);

MapTitle.SetX(m_Map.GetMapScreenWidth() / 2);

MapTitle.SetY(m_Map.GetMapScreenHeight());

// The title will be placed directly below the X,Y value

MapTitle.SetPosition(miPositionBC);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Page 392: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Title.Border property (Title object)

Example in Visual Basic

Private Sub PositionTitle()

' Place the title at the bottom center of the screen

Map1.Title.Editable = False

Map1.Title.X = Map1.MapScreenWidth / 2

Map1.Title.Y = Map1.MapScreenHeight

' The title will be placed directly below the X,Y value

Map1.Title.Position = miPositionBC

End Sub

Title.Border property (Title object)

Purpose

Controls whether or not to draw the title's border. This is a Boolean value, and defaults to True.

Title.Caption property (Title object)

Purpose

Contains the text of the Title. This is a String value. This is a default property of the Title object.

Title.Editable property (Title object)

Purpose

Controls whether the title is editable by the end user. By this we mean whether the user can click on it and move it, resize it, or change its text. This is a Boolean value, and defaults to True.

Title.Position property (Title object)

Purpose

Contains a value indicating how the text should be drawn with respect to the X,Y coordinates. This takes a PositionsConstants value, and the default is miPositionCC.

378 MapX Reference

Page 393: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Title.TextStyle property (Title object)

Title.TextStyle property (Title object)

Purpose

A Style object containing the style of the title.

Title.Visible property (Title object)

Purpose

Controls whether the title is visible or not. This is a Boolean value, and defaults to True.

Title.X property (Title object)

Purpose

Contains the X coordinate of the title. This is a Float value, and represents Screen coordinates. The position of the title is controlled by the X,Y coordinates in conjunction with the Position property, which controls how the title sits with respect to the X,Y coordinates.

Title.Y property (Title object)

Purpose

Contains the Y coordinate of the title. This is a Float value, and represents Screen coordinates. The position of the title is controlled by the X,Y coordinates in conjunction with the Position property, which controls how the title sits with respect to the X,Y coordinates.

Mapx Referenc 379

Page 394: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Title.Y property (Title object)

380 MapX Reference

Page 395: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

MapX Events

Custom Events

MapX supports the following custom events:

Event Dispatch ID Called…

AddFeatureToolUsed Event 16 when an Add Feature tool is used.

AnnotationAdded event 7 when annotation is added.

AnnotationChanged event 8 when annotation is added, modified, or deleted.

DataMismatch event 5 during data binding, if a row doesn't match

DrawUserLayer Event 10 when the map window needs updating and the application has created a UserDraw layer

MapDraw event 15 will be called once before a draw, and once after a draw is completed.

MapInitialized event 13 after map initialization is complete

MapViewChanged event 6 the map's minimum bounding rectangle has changed (e.g. when you zoom or pan)

MouseWheel Event 12 when a user uses the mouse wheel

PolyToolUsed Event 11 when user uses a polytool (e.g. to draw a polyline)

RequestData event 4 called to request data from a cell container when dealing with unbound data

ResolveDataBind event 2 during automatic data binding, if data is ambiguous

Page 396: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

AddFeatureToolUsed Event

Stock events

MapX supports the following stock events:

Depending on your development environment, you may be able to use other events as well. For example, Visual Basic provides support for these events: DragDrop, DragOver, GotFocus, LostFocus.

AddFeatureToolUsed Event This event is called whenever the user uses one of the standard object creation tools (miAddPointTool, miAddLineTool, miAddPolylineTool, or miAddRegionTool). The behavior of this event is similar to the PolyToolUsed Event.

Dispatch ID = 16

ResolveDataBindEx event 14 has the same function as the ResolveDataBind event, but it passes a collection of ResolveObjects instead of a string array.

SelectionChanged event 1 when the selection changes

ThemeModifyRequested event 9 when user double-clicks legend

ToolUsed event 3 when user uses a tool on the map

Event OLE Dispatch ID Description

Click -600 The user presses and releases a mouse button.

DblClick -601 The user double-clicks.

KeyDown -602 The user presses down on a key. Useful for building modifiers for mouse activities.

KeyPress -603 The user presses a key.

KeyUp -604 The user releases a key.

MouseDown -605 The user presses a mouse button.

MouseMove -606 The user moves the mouse. Can be used to displays cursor coordinates in the Status Bar.

MouseUp -607 The user releases a mouse button.

Error -608 An error occurs during an asynchronous activity such as a redraw, or when a user is using a map tool.

382 MapX Reference

Page 397: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

AddFeatureToolUsed Event

Syntax

AddFeatureToolUsed (ByVal ToolNum As Integer, ByVal Flags As Long, Feature As Object, ByVal Shift As Boolean, ByVal Ctrl As Boolean, EnableDefault As Boolean)

Remarks

This event is fired multiple times during every use of the object creation tools:

Once at the beginning of the tool use, when the user clicks to place the first node of the feature. During this call, the Flags variable is set to miToolBegin (0).

For the Add Polyline and Add Region tools, it is fired once for every time the user clicks to add another node, and also for every time the user deletes a node by pressing the BACKSPACE keyDuring this call, the Flags variable has a value equal to miToolInProgress (3).

Fired once at the end of the tool use, when the user performs one of these actions:• Ends the drawing of the feature by double clicking (polyline and polygon tools) or

releasing the mouse (line and point tools), in which case the Flags variable will be set to miToolEnd (1); -or-

• Presses the ESC key to end the add feature tool, in which case the Flags variable will be set to miToolEndEscaped (2); -or-

• Uses the backspace key to delete all of the nodes, in which case the Flags variable will be set to miToolEndEscaped (2) .

Part Description

ToolNum Indicates the tool number of the Add Feature tool.

Flags A ToolFlagConstants value; this indicates whether the user is starting, in the process of, or finishing the tool use.

Feature A Feature object representing the feature that the user has created thus far.

Shift, Ctrl Boolean values that indicate whether modifier keys (SHIFT, CTRL) were pressed at the time the event was fired; True indicates that a key was pressed.

EnableDefault Boolean. This parameter controls whether MapX allows the tool's standard behavior to take effect. Default value is True. To prevent the tool's standard behavior (e.g. to cancel the user's action), set this parameter to False. This parameter only takes effect when the user concludes the tool use (miToolEnd).

Mapx Referenc 383

Page 398: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

AnnotationAdded event

AnnotationAdded event

Purpose

This event that is called whenever an annotation is added, modified, or deleted. It is called right before the annotation is changed. The programmer also has an opportunity to prevent the operation.

Dispatch ID = 7

Syntax

AnnotationAdded

object pointer to the annotation object

Example in Visual Basic

Private Sub Map1_AnnotationAdded(ByVal Annotation As Object)

Select Case Annotation.Type

Case miSymbolAnnotation

Debug.Print "Symbol Annotation Added"

Case miTextAnnotation

Debug.Print "Text Annotation Added."

End Select

Debug.Print " There are " & Map1.Annotations.Count & _

" annotations."

End Sub

Example in C++

void CSampleProjectView::OnAnnotationAdded(LPDISPATCH Annotation_Disp) {

CMapXAnnotation annotation;

// To attach an LPDISPATCH to a MapX object, use

// the object.AttachDispatch(Dispatch,FALSE); syntax

annotation.AttachDispatch(Annotation_Disp,FALSE);

try {

switch(annotation.GetType()) {

case miSymbolAnnotation:

AfxMessageBox("Symbol annotation added.");

break;

case miTextAnnotation:

AfxMessageBox("Text annotation added.");

break;

}

384 MapX Reference

Page 399: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

AnnotationChanged event

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

AnnotationChanged event

Purpose

An event that is called whenever an annotation is added, modified, or deleted. This is called right before the annotation is changed, and the programmer has an opportunity to prevent the operation.

Dispatch ID = 8

Note: The event is only fired for changes brought about by user interaction (like selecting the annotation, moving the annotation, resizing it, etc.), NOT through programmatic changes in the annotations. For example, this will not fire the AnnotationChanged event: annotation.X = 100. Even though it is moving the annotation.

Syntax

AnnotationChanged

int changetype { ADD, DEL, MOD }

object pointer to the annotation object

int EnableDefault

Example in Visual Basic

Private Sub Map1_AnnotationChanged(ByVal ChangeType As Integer,_ ByVal Annotation As Object, EnableDefault As Boolean)

Dim sType As String

Select Case Annotation.Type

Case miSymbolAnnotation

sType = "Symbol"

Case miTextAnnotation

sType = "Text"

End Select

Select Case ChangeType

Mapx Referenc 385

Page 400: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

AnnotationChanged event

Case miAddAnnotation

Debug.Print "About to add a " & sType & " annotation"

Case miDeleteAnnotation

Debug.Print "I will disallow the deletion of this " _

& sType & " annotation"

EnableDefault = False `Prevent annotation from being _

changed

Case miEditAnnotation

Debug.Print "About to change a " & sType & " annotation"

Case miSelectAnnotation

Debug.Print "About to select a " & sType & " annotation"

End Select

End Sub

Example in C++

void CSampleProjectView::OnAnnotationChanged(short ChangeType, LPDISPATCH Annotation_Disp, BOOL FAR* EnableDefault) {

CMapXAnnotation annotation;

CString sType, text;

annotation.AttachDispatch(Annotation_Disp,FALSE);

try {

switch(annotation.GetType()) {

case miSymbolAnnotation:

sType = "Symbol"; // Symbol annotation added

break;

case miTextAnnotation:

sType = "Text"; // Text annotation added

break;

}

switch(ChangeType) {

case miAddAnnotation:

text = "About to add a "; text += sType; text += " annotation";

break;

case miDeleteAnnotation:

text = "I will disallow the deletion of this"; text += sType; text += " annotation";

(*EnableDefault) = FALSE; // Prevent the annotation from being changed

break;

case miEditAnnotation:

386 MapX Reference

Page 401: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataMismatch event

text = "About to change a "; text += sType; text += " annotation";

break;

case miSelectAnnotation:

text = "About to select a "; text += sType; text += " annotation";

break;

}

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

AfxMessageBox(text);

}

DataMismatch event

Purpose

This event is called when a row doesn't match an object in the map during data binding.

Once MapX knows a geocolumn for a data set, it can then bind it to a map. However, MapX may encounter a row that doesn't match an object in the map. In the default case, it is simply skipped over. If the DataMismatch event handler is defined, we will send an event to it when a row doesn't match.

Dispatch ID = 5

Syntax

DataMismatch

int rownum

string geocolvalue

Part Description

rownum Row number in the general data source that didn't match.

GeoColValue Value of the field that didn't match.

Mapx Referenc 387

Page 402: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataMismatch event

Example in Visual Basic

Private Sub Command1_Click()

Dim i As Integer

Dim flds As New MapXLib.Fields

Dim ds As Dataset

mapData(1, 1) = "ME"

mapData(2, 1) = "NH"

mapData(3, 1) = "VT"

mapData(4, 1) = "MA"

mapData(5, 1) = "RL" `This will trigger the mismatch

mapData(6, 1) = "CT"

mapData(7, 1) = "NY"

For i = 1 To 7

mapData(i, 2) = i * 100

Next

flds.Add "State", "State", miAggregationIndividual, _

miTypeString

flds.Add "Value", "Value", miAggregationSum, miTypeNumeric

Set ds = Map1.Datasets.Add(miDataSetUnbound, Nothing, _

"My Dataset", "State", , "USA", flds)

ds.Themes.Add

End Sub

Private Sub Map1_DataMismatch(ByVal DataSetName As String, _

ByVal Row As Long, GeoFieldValue As String)

Debug.Print "Unmatched Value: " & GeoFieldValue

Debug.Print " In Row: " & Row

Debug.Print " will change to ""RI"""

GeoFieldValue = "RI"

End Sub

Private Sub Map1_RequestData(ByVal DataSetName As String, _

ByVal Row As Long, _

ByVal Field As Integer, _

Value As Variant, Done As Boolean)

Done = False

If DataSetName <> "My Dataset" Or Row > 7 Then

Done = True

Else

388 MapX Reference

Page 403: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataMismatch event

Value = mapData(Row, Field)

End If

End Sub

Example in C++

struct StateData { char name[3]; int value; };

StateData MapData[7] = {

{"ME",100},

{"NH",200},

{"VT",300},

{"MA",400},

{"RL",500}, // This will trigger the mismatch

{"CT",600},

{"NY",700}};

void CSampleProjectView::Start() {

COleVariant FieldsVariant;

CMapXFields flds;

CMapXDataset ds;

if(!flds.CreateDispatch(flds.GetClsid())) {

TRACE0("Failed to Create Fields object");

return;

}

try {

flds.Add(COleVariant("State"),COleVariant("State"),COleVariant((long)miAggregationIndividual),COleVariant((long)miTypeString));

flds.Add(COleVariant("Value"),COleVariant("Value"),COleVariant((long)miAggregationSum),COleVariant((long)miTypeNumeric));

FieldsVariant.vt = VT_DISPATCH;

FieldsVariant.pdispVal = flds.m_lpDispatch;

ds = m_Map.GetDatasets().Add(miDataSetUnbound,COptionalVariant(),COleVariant("My Dataset"),COleVariant("State"),COptionalVariant(),COptionalVariant("USA"),FieldsVariant,COptionalVariant());

Mapx Referenc 389

Page 404: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DataMismatch event

ds.GetThemes().Add();

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

void CSampleProjectView::OnRequestData(LPCTSTR DataSetName, long Row, short Field, VARIANT FAR* Value, BOOL FAR* Done) {

*Done = FALSE;

if(!strcmp(DataSetName,"My Dataset") || Row > 7)

*Done = TRUE;

else {

if(Field == 1) {

Value->vt = VT_BSTR;

Value->bstrVal = CString(MapData[Row].name).AllocSysString();

} else {

Value->vt = VT_INT;

Value->iVal = MapData[Row].value;

}

}

}

void CSampleProjectView::OnDataMismatch(LPCTSTR DataSetName, long Row, BSTR FAR* GeoFieldValue) {

CString DebugString;

DebugString.Format("Unmatched Value: %s\nIn row: %d\nWill change to \"RI\"",*GeoFieldValue,Row);

*GeoFieldValue= CString("RI").AllocSysString();

AfxMessageBox(DebugString);

390 MapX Reference

Page 405: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DrawUserLayer Event

DrawUserLayer Event

Purpose

When the application creates a UserDraw layer using the AddUserDrawLayer method of the Layers collection, an event is fired to the application when the window needs updating:

Dispatch ID = 10

Syntax

DrawUserLayer (Layer, hOutputDC, hAttributeDC, RectFull, RectInvalid)

The rectangles are objects of type Rectangle. The coordinates in the rectangles are screen (client) coordinate .

Remarks

You can also add a UserDrawLayer via Layers.Add.

Example in Visual Basic

' API DEFS should be declared in a separate module

Declare Function MoveToEx Lib "gdi32" Alias "MoveToEx" _

(ByVal hdc As Long, ByVal x As Long, ByVal y As Long, lpPoint _

As POINTAPI) As Long

Declare Function LineTo Lib "gdi32" Alias "LineTo" (ByVal hdc _

As Long, ByVal x As Long, ByVal y As Long) As Long

Declare Function SetMapMode Lib "gdi32" Alias "SetMapMode" _

(ByVal hdc As Long, ByVal nMapMode As Long) As Long

Type POINTAPI

x As Long

y As Long

End Type

Public Const MM_TWIPS = 6

' this sets the UserDraw Layer to "My Layer"

Dim lyr as Layer

Part Description

Layer Layer object: the layer to draw.

hOutputDC OLE_HANDLE: device context to draw to.

hAttributeDC OLE_HANDLE: device context to draw to; usually the same as hOutputDC, except when drawing to a metafile device context.

RectFull Rectangle object: the full window.

RectInvalid Rectangle object: the invalidated area.

Mapx Referenc 391

Page 406: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DrawUserLayer Event

Set lyr = Map1.Layers.AddUserDrawLayer("My Layer", 1)

' this example draws a line between the corners of Wyoming

Private Sub Map1_DrawUserLayer(ByVal Layer As Object, ByVal _

hDC As Long, ByVal RectFull As Object, ByVal RectInvalid As _

Object)

Dim pt As POINTAPI

SetMapMode hDC, MM_TWIPS

dim PX as single

dim PY as single

X1 = -111.0542

Y1 = 45.0009

X2 = -104.0528

Y2 = 41.0018

if map1.ClipLine(X1,Y1,X2,Y2) then

map1.ConvertCoord(PX, PY, X1,Y1, miMapToScreen)

MoveToEx hDC, PX, -PY, pt ' win api call

map1.ConvertCoord(PX, PY, X2,Y2, miMapToScreen)

LineTo hDC, PX, -PY ' win api call

end if

End Sub

Example in C++

void CSampleProjectView::CreateDrawLayer() {

try

m_Map.GetLayers().AddUserDrawLayer("My Layer",1);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

void CSampleProjectView::OnDrawUserLayer(LPDISPATCH Layer, long hOutputDC, long hAttributeDC, LPDISPATCH RectFull, LPDISPATCH RectInvalid)

{

// This example draws a line between the corners of Wyoming

CDC dc;

CPen pen,*oldPen;

392 MapX Reference

Page 407: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DrawUserLayer Event

float PX,PY;

double X1,Y1,X2,Y2;

pen.CreatePen(0,1,(COLORREF)0);

dc.Attach((HDC)hOutputDC); // Attach the hDC to the MFC object dc

dc.SetAttribDC((HDC)hAttributeDC);

dc.SetMapMode(MM_TWIPS);

//Set pen to black

oldPen = dc.SelectObject(&pen);

X1=-111.0542;

Y1=45.0009;

X2=-104.0528;

Y2=41.0018;

try {

m_Map.ConvertCoord(&PX,&PY,&X1,&Y1,miMapToScreen);

dc.MoveTo((int)PX,(int)-PY);

m_Map.ConvertCoord(&PX,&PY,&X2,&Y2,miMapToScreen);

dc.LineTo((int)PX,(int)-PY);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

dc.SelectObject(oldPen);

dc.ReleaseAttribDC(); // Release the hDC

dc.Detach();

}

Mapx Referenc 393

Page 408: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

MapDraw event

MapDraw eventThis event will be called once before a draw, and once after a draw is completed. There is one parameter which states whether a draw is beginning or ending.

Disp ID = 15

Syntax

MapDraw (Flag)

Flag: Either miDrawBegin or miDrawEnd.

See Also

MapDrawConstants

MapInitialized event

Purpose

This event is called immediately after map initialization is complete. It serves to notify the container application of the best time to do any necessary run-time configuration.

Dispatch ID = 13

Syntax

MapInitialized < no parameters >

MapViewChanged event

Purpose

This event is called whenever the distance across the control (map) changes or the centerpoint is moved.

Dispatch ID = 6

Syntax

MapViewChanged < no parameters >

394 MapX Reference

Page 409: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

MouseWheel Event

Example in Visual Basic

Private Sub Map1_MapViewChanged()

Debug.Print "The map view has changed."

Debug.Print " New center: " & Map1.CenterX & ", " _

& Map1.CenterY

Debug.Print " New Zoom Level: " & Map1.Zoom

End Sub

Example in C++

void CSampleProjectView::OnMapViewChanged() {

CString msg;

try {

msg.Format("The map view has changed.\nNew Center: %lf, %lf\nNew Zoom Level: %lf",m_Map.GetCenterX(),m_Map.GetCenterY(),m_Map.GetZoom());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

AfxMessageBox(msg);

}

MouseWheel Event

Purpose

The Intellimouse provides a wheel as a third (middle) button on the Microsoft mouse. In addition to the regular mouse button messages, the wheel sends a MOUSEWHEEL message when turned.

The Mousewheel will zoom the map when rolled, scroll the map up and down when the wheel is rolled with the control key down, and "AutoScroll" when the middle button is held down and moved away from the mouse click point. The speed is of the scrolling is proportional to the distance of the cursor from the mouse-click point. The MouseWheel event for allows you to override this built-in behavior of the Mousewheel.

Note that there is no support in Visual Basic under Windows 95 for the Mousewheel, but third party ActiveX controls have been built that you can use to take advantage of the Mousewheel. (That is, you put another control on your form that gathers and sends along the MOUSEWHEEL messages.)

Dispatch ID = 12

Mapx Referenc 395

Page 410: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

PolyToolUsed Event

Syntax

MouseWheel(ByVal Flags As Long, ByVal zDelta As Integer, X As Single, Y As Single, EnableDefault As Boolean)

PolyToolUsed Event This event is called whenever the user draws a polyline or polygon, using either the standard tool miPolygonSelectTool (1010), or a custom tool of type miToolTypePoly (4).

Dispatch ID = 11

Part Description

Flags Indicates whether various virtual keys are down. This parameter can be any combination of the following values: MK_CONTROL: Set if the CTRL key is down. MK_LBUTTON: Set if the left mouse button is down. MK_MBUTTON: Set if the middle mouse button is down. MK_RBUTTON: Set if the right mouse button is down. MK_SHIFT: Set if the SHIFT key is down.

zDelta The value of the high-order word of wParam. Indicates the distance that the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user

X Specifies the x-coordinate of the pointer, relative to the upper-left corner of the screen.

Y Specifies the y-coordinate of the pointer, relative to the upper-left corner of the screen.

EnableDefault Boolean. This parameter controls whether MapX allows the mousewheel's standard behavior to take effect. Default value is True. If the programmer sets EnableDefault to FALSE, MapX will not do anything in response to the mousewheel.

396 MapX Reference

Page 411: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

PolyToolUsed Event

Syntax

PolyToolUsed(ToolNum As Integer, Flags As Long, Pts As Object,

Shift As Boolean, Ctrl As Boolean, EnableDefault As Boolean)

Remarks

This event is fired multiple times during every use of the PolyTool.

Once at the beginning of the tool use, when the user clicks to place the first node of the polyline/polygon. During this call, the Flags variable is set to miPolyToolBegin (0).

Once for every time the user clicks to add another node to the polyline, and also for every time the user deletes a node by pressing the BACKSPACE key. During this call, the Flags variable has a value equal to miPolyToolInProgress (3).

Once at the end of the tool use, when the user performs one of these actions:• Double-clicks to end the drawing of the polygon, in which case the Flags variable

will be set to miPolyToolEnd (1); -or-• Presses the ESC key to end the drawing of the polygon, in which case the Flags

variable will be set to miPolyToolEndEscaped (2); -or-• Uses the backspace key to delete all of the nodes, in which case the Flags variable

will be set to miPolyToolEndEscaped (2)

Part Description

ToolNum Indicates the custom tool number.

Flags A PolyToolFlagConstants value; this indicates whether the user is starting or finishing the tool use.

Pts A collection of points (the same kind as used in Feature.Parts.Add).

Shift, Ctrl Boolean values that indicate whether modifier keys (SHIFT, CTRL) were pressed at the time the event was fired; True indicates that a key was pressed. For the standard tool miPolygonSelectTool, MapX only uses the state of these keys when the user concludes the tool use (i.e. when the Flag parameter is miPolyToolEnd).

EnableDefault Boolean. If this event was triggered by the standard miPolygonSelectTool, this parameter controls whether MapX allows the tool's standard behavior to take effect. Default value is True. To prevent the tool's standard behavior (e.g. to cancel the user's action), set this parameter to False. This parameter only takes effect when the user concludes the tool use (miPolyToolEnd).

Mapx Referenc 397

Page 412: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

PolyToolUsed Event

Using custom polytools (Visual Basic example)

Once you have used the CreateCustomTool method to create a polytool, the following example shows you how to handle the PolyToolUsed event. This example lets the user draw a region or line feature to Layer 1.

Private Sub map1_PolyToolUsed(ByVal ToolNum As Integer, _

ByVal Flags As Long,

ByVal pts As Object, ByVal Shift As Boolean, ByVal Ctrl As _

Boolean, EnableDef As Boolean

If Flags = miPolyToolBegin Then

'Someone's beginning the use of a PolyTool..

. ElseIf Flags = miPolyToolEnd Then

' The user finished using a PolyTool by double clicking

If ToolNum = MY_SUPER_POLYGON_TOOL Then

' They used MY_POLYGON_TOOL! Make a new

' region feature and add it to the first layer

Dim f As New Feature

f.Type = miFeatureTypeRegion

f.Style.RegionPattern = miSolid

f.Style.RegionColor = 25

f.Style.RegionBorderColor = 0

f.Style.RegionBorderWidth = 2

f.Style.RegionBorderStyle = 1

'Use the points that were given to me by the event.

'MapX automatically closes open polygons, so I don't

'have to worry about that!

f.Parts.Add pts

map1.Layers(1).AddFeature f

ElseIf ToolNum = MY_SUPER_POLYLINE_TOOL Then

' They used MY_POLYLINE_TOOL! Make a new

' line feature and add it to the first layer!

Dim f As New Featur

f.Type = miFeatureTypeLine

f.Style.LineStyle = 1

f.Style.LineColor = 255

f.Style.LineWidth = 2

'Use the points that were given to me by the event

. f.Parts.Add pts

map1.Layers(1).AddFeature f

End If

398 MapX Reference

Page 413: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

PolyToolUsed Event

ElseIf Flags = miPolyToolEndEscaped Then

' The users hit 'Esc' or backspaced all the nodes

' away... don't add anything in

. End If

End Sub

Example in C++

const short CUSTOM_POLYGON_TOOL = 42

const short CUSTOM_POLYLINE_TOOL = 43;

void CSampleProjectView::OnPolyToolUsed(short ToolNum, long Flags, LPDISPATCH Points, BOOL bShift, BOOL bCtrl, BOOL FAR* EnableDefault) {

if(Flags==miPolyToolEnd) {

// The user double clicked to end the PolyTool

if(ToolNum==CUSTOM_POLYGON_TOOL) {

// Make a new region feature and add it to the first layer

CMapXFeature f;

CMapXPoints pts;

pts.AttachDispatch(Points,FALSE);

if(!f.CreateDispatch(f.GetClsid())) {

TRACE0("Failed to Create Point object");

return;

}

try {

f.Attach(m_Map.GetDispatch());

// Setup the style of the polygon

f.SetType(miFeatureTypeRegion);

f.GetStyle().SetRegionPattern(miPatternSolid);

f.GetStyle().SetRegionColor(255);

f.GetStyle().SetRegionBorderColor(0);

f.GetStyle().SetRegionBorderWidth(2);

f.GetStyle().SetRegionBorderStyle(1);

// Now add the points that were given by the event

f.GetParts().Add(pts);

m_Map.GetLayers().Item(1).AddFeature(f);

} catch (COleDispatchException *e) {

e->ReportError();

Mapx Referenc 399

Page 414: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

PolyToolUsed Event

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

} else if(ToolNum==CUSTOM_POLYLINE_TOOL) {

CMapXFeature f;

CMapXPoints pts;

pts.AttachDispatch(Points,FALSE);

if(!f.CreateDispatch(f.GetClsid())) {

TRACE0("Failed to Create Feature object");

return;

}

try {

f.Attach(m_Map.GetDispatch());

// Set up the style of the polyline

f.SetType(miFeatureTypeLine);

f.GetStyle().SetLineStyle(1);

f.GetStyle().SetLineColor(255);

f.GetStyle().SetLineWidth(2);

// Now add the points that were given by the event

f.GetParts().Add(pts);

m_Map.GetLayers().Item(1).AddFeature(f);

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

} // Other possible Flag values:

// miPolyToolBegin The user began the use of the tool

// miPolyToolEndEscaped The user cancelled the tool

// miPolyToolInProgressThe user added a new node to the polyline or deleted a node using BACKSPACE

}

400 MapX Reference

Page 415: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RequestData event

RequestData event

Purpose

This is event is called to request data from a cell container when dealing with unbound data.

Dispatch ID = 4

Syntax

RequestData

int row

int column

variant value

int done

Set the done flag when there is no more data to pass to the container

Example in Visual Basic

` This sample demonstrates the use of Datasets.Add and

` the RequestData

` event supported by MapX to build an unbound dataset, which

` allows MapX to access data whose format is known only to the

` programmer. In this example, the data is in the form of a

` two-dimensional array in VB.

Private Const kNumberOfRows = 3

Dim theData(1 To 3, 1 To 2) As Variant

Private Sub Form_Load()

theData(1, 1) = "ME" `Fill in the data to

theData(2, 1) = "NH" `be used by RequestData

theData(3, 1) = "VT"

theData(1, 2) = 100

theData(2, 2) = 200

theData(3, 2) = 300

Map1.ZoomTo 800, -70.26, 44.05 `Zoom in on New England

End Sub

Private Sub Command1_Click()

Dim flds As New MapXLib.Fields

Dim ds As Dataset

`Describe the structure of the unbound dataset:

flds.Add "State", "State", miAggregationIndividual,_

Mapx Referenc 401

Page 416: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RequestData event

miTypeString

flds.Add "Sales", "Sales", miAggregationSum, miTypeNumeric

`Create the unbound dataset. The "RequestData" event will be

`triggered to get the data to be used.

Set ds = Map1.Datasets.Add(miDatasetUnbound, Nothing,

"My Dataset", "State", , "USA", flds)

`Create a theme based on the "Sales" column in the unbound dataset

ds.Themes.Add miThemeGradSymbol, "Sales", "My Theme"

End Sub

Private Sub Map1_RequestData(ByVal DataSetName As String, _

ByVal Row As Long, ByVal Field As Integer, _

Value As Variant, Done As Boolean)

Done = False

If DataSetName <> "My Dataset" Or Row > kNumberOfRows Then

Done = True

Else

Value = theData(Row, Field)

End If

End Sub

Example in C++

struct StateData { char name[3]; int value; };

StateData MapData[3] = {

{"ME",100},

{"NH",200},

{"VT",300}};

void CSampleProjectView::Start() {

COleVariant FieldsVariant;

CMapXFields flds;

CMapXDataset ds;

// Create a new, empty fields collection

if(!flds.CreateDispatch(flds.GetClsid())) {

TRACE0("Failed to Create Fields collection");

return;

}

402 MapX Reference

Page 417: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

RequestData event

try {

flds.Add(COleVariant("State"),COleVariant("State"),COleVariant((long)miAggregationIndividual),COleVariant((long)miTypeString));

flds.Add(COleVariant("Value"),COleVariant("Value"),COleVariant((long)miAggregationSum),COleVariant((long)miTypeNumeric));

FieldsVariant.vt = VT_DISPATCH;

FieldsVariant.pdispVal = flds.m_lpDispatch;

ds = m_Map.GetDatasets().Add(miDataSetUnbound,COptionalVariant(),COleVariant("My Dataset"),COleVariant("State"),COptionalVariant(),COleVariant("USA"),FieldsVariant,COptionalVariant());

ds.GetThemes().Add(miThemeGradSymbol,"Sales","My Theme");

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

void CSampleProjectView::OnRequestData(LPCTSTR DataSetName, long Row, short Field, VARIANT FAR* Value, BOOL FAR* Done) {

*Done = FALSE;

if(strcmp(DataSetName,"My Dataset") || Row > 3)

*Done = TRUE;

else {

if(Field == 1) {

Value->vt = VT_BSTR;

Value->bstrVal = CString(MapData[Row].name).AllocSysString();

} else {

Value->vt = VT_INT;

Value->iVal = MapData[Row].value;

}

}

}

Mapx Referenc 403

Page 418: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ResolveDataBind event

ResolveDataBind event

Purpose

Automatic Data Binding can encounter ambiguous situations. Theses situations include: multiple geocolumns are detected in the user data, multiple layers are detected that match the geocol,multiple geosets are available for the matched map layer. In these cases, MapX will take the first one, unless the following ResolveDataBind event handler is defined. If defined, MapX will call it, and let the handler choose which one to use.

Dispatch ID = 2

Syntax

ResolveDataBind (flag, nummatches, matches, choice, cancel )

Remarks

ResolveDataBind could get fired 3 times.

First, it chooses columns in the source table, then for the chosen column it chooses a table if there are > 1, and lastly, for the table it chooses geosets if there are > 1.

The geodict list geosets for each table.0

ResolveDataBindEx event

Purpose

This event has the same function as the ResolveDataBind event, but it passes a collection of ResolveObjects instead of a string array. So, for situations like multiple geocolumns being detected in the user data, multiple layers detected that match the geocol, or multiple geosets available for the matched map layer, MapX will take the first one, unless either the ResolveDataBind or the ResolveDataBindEx event handler is defined. If defined, MapX will call one, and let the handler choose which one to use.

Dispatch ID = 14

Part Description

flag Indicates if the event is being called because of multiple geocols (0), multiple layers (1), or multiple geosets (2).

nummatches Indicates how many entries are in the matches array. The array of strings matches contains list of matches.

matches Variant: Represents an array of strings.

choice The return variable. 1 based. 0 means auto–select and has MapX choose the best one).

cancel Allows the user to cancel the data bind and causes it to fail.

404 MapX Reference

Page 419: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

SelectionChanged event

Syntax

ResolveDataBindEx (flag, nummatches, matches, choice, cancel )

Remarks

ResolvedatabindEx is fired only for multiplegeocolumns and only if choice is set to 0 during ResolveDataBind Event.

SelectionChanged event

Purpose

This event is called whenever the selection changes and enables the container to react to a selection made on the map. The selection can change as a result of a user using a selection tool, or by using one of the Selection methods from the Layer object.

Dispatch ID = 1

Syntax

SelectionChanged

Example

Private Sub Map1_SelectionChanged()

Dim l As Layer

Dim f As Feature

Dim parNode As Node

TreeView1.Nodes.Clear

For Each l In Map1.Layers

If l.Selection.Count > 0 Then

Set parNode = TreeView1.Nodes.Add(, , l.Name, l.Name)

parNode.Expanded = True

For Each f In l.Selection

Part Description

flag Indicates the event is being called because of multiple geocols. This flag is always set to zero.

nummatches Indicates how many entries are in the matches collection.

matches Variant: Represents a collection of ResolveObject objects.

choice The return variable. 1 based. 0 means auto–select and has MapX choose the best one.

cancel Allows the user to cancel the data bind and causes it to fail.

Mapx Referenc 405

Page 420: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ThemeModifyRequested event

TreeView1.Nodes.Add parNode, tvwChild, parNode.Key & _

f.Name, f.Name

Next

End If

Next

End Sub

ThemeModifyRequested event

Purpose

This event is called when a user double clicks on a thematic legend. The parameter is the Theme object that `owns' the legend. The purpose for this event is to be able to write code let the user modify theme or legend properties when the user double clicks on the legend.

Dispatch ID = 9

Syntax

ThemeModifyRequested

Theme as object

Example in Visual Basic

Private Sub Map1_ThemeModifyRequested(ByVal Theme As Object)

Debug.Print "User Double-Clicked the legend for the theme:"

Debug.Print " """ & Theme.Name & """"

End Sub

Example in C++

void CSampleProjectView::OnThemeModifyRequested(LPDISPATCHThemeDispatch) {

CMapXTheme theme;

CString msg;

theme.AttachDispatch(ThemeDispatch,FALSE);

try {

msg.Format("User Double-Clicked the legend for thetheme:\n\"%s\"", theme.GetName());

} catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

} catch (COleException *e) {

e->ReportError();

e->Delete();

406 MapX Reference

Page 421: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ToolUsed event

}

AfxMessageBox(msg);

}

ToolUsed event The ToolUsed event is called when the user uses a custom tool on the map. This procedure allows you to determine how the tool was used; for example, it tells you the map coordinates where the user clicked. Within the ToolUsed procedure, you write code to carry out the intended functionality of the tool.

This event is also called when a standard tool is used, in which case the event is called after the user interaction, but before the operation is executed for standard tools.

Dispatch ID = 3

Syntax

ToolUsed(ToolNum, x1, y1, x2, y2, distance, shift, control, *EnableDefault)

Part Description

ToolNum Integer: Indicates the tool number. Note that if you create multiple custom tools, this event is called when any of those tools are used; therefore, you need to check ToolNum to determine which tool is in use.

x1, y1 Double: Map coordinates where user clicked.

x2, y2 Double: Map coordinates where the user ended the tool use; does not apply to Point tools, which do not allow dragging.

distance Double: Distance, in Map Units, between beginning location and ending location.

shift Boolean: Indicates whether user held down SHIFT KEY.

control Boolean: Indicates whether user held down CTRL KEY.

*EnableDefault Boolean: In cases where a standard tool is being used, this parameter controls whether MapX allows the tool's standard behavior to take effect. Default value is True. To prevent the tool's standard behavior (e.g. to cancel the user's action), set this parameter to False.

Mapx Referenc 407

Page 422: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ToolUsed event

Using custom tools (Visual Basic example)

This example demonstrates: • Using the Map.CreateCustomTool method to create a custom "line" tool (a tool that

lets the user click and drag to draw a line). • Using the ToolUsed event to carry out an action when the user uses the custom

tool.

' The following code in the Form_Load event of a form with

' a Map Object (Map1) creates a Custom Tool that is a

' "line-type" tool (it lets the user click and drag).

Private Sub Form_Load()

Map1.CreateCustomTool 1, miToolTypeLine, miIconCursor

End Sub

' The following code is called whenever any tool is used on the map.

' If the Current Tool is #1 (created above) then the code within the

' If-Then statement will be true, and we will set the caption of

' a label "lblDistance" equal to the Distance passed in with the

' "line-type" tool.

Private Sub Map1_ToolUsed(ByVal ToolNum As Integer, ByVal X1 _

As Double, ByVal Y1 As Double, ByVal X2 As Double, ByVal Y2 _

As Double, ByVal Distance As Double, ByVal Shift As Boolean, _

ByVal Ctrl As Boolean, EnableDefault As Boolean)

If ToolNum = 1 then

lblDistance.Caption = Str$(Distance)

End If

End Sub

Using custom tools (C++ example)

Once you have used the CreateCustomTool method to create custom tools, use the ToolUsed event to carry out an action when the user uses the custom tool.

This example tests to see which tool is being used. Then, depending on which tool is in use, this example either:

• Changes the style of the map feature underneath the cursor, or • Places a new symbol where the user clicked.

void CMapxSampleView::OnToolUsed(short ToolNum, double X1,

double Y1, double X2, double Y2, double Distance,

BOOL Shift, BOOL Ctrl, BOOL* EnableDefault)

{

CString str;

CMapXPoint pnt;

408 MapX Reference

Page 423: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ToolUsed event

str.Format("Tool=%d, [%f,%f] [%f, %f], dist=%f, %s %s\n",

ToolNum, X1,Y1,X2,Y2,Distance, (Shift)?"Shift":"",(Ctrl)?"Ctrl":"");

TRACE(str);

// change the style of the feature under the cursor

if (ToolNum == MAP_TOOL_CHANGESTYLE) {

try {

// Need the dispatch to use the point

if (pnt.CreateDispatch(pnt.GetClsid())) {

pnt.Set(X1, Y1);

}

else {

// something went wrong, can't use the point...

AfxThrowOleException(CO_E_CLASS_CREATE_FAILED);

}

CMapXLayers layers = m_ctrlMapX.GetLayers();

// Get the USA feature under the cursor

CMapXFeatures ftrs = layers.Item("USA").SearchAtPoint(LPDISPATCH(pnt));

// work on only the first feature

CMapXFeatureftr = ftrs.Item(1);

// get the style object from the feature

CMapXStylestyle = ftr.GetStyle();

style.SetRegionBackColor(255);

// update the feature in the layer

ftr.Update();

}

catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

}

catch (COleException *e) {

e->ReportError();

e->Delete();

}

}

Mapx Referenc 409

Page 424: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ToolUsed event

// place a new symbol at the point clicked on

else if (ToolNum == MAP_TOOL_NEWPOINT) {

try {

CMapXLayers layers = m_ctrlMapX.GetLayers();

CMapXFeatureftr;

// Need the dispatch id to use the feature

if (ftr.CreateDispatch(ftr.GetClsid())) {

// Symbol feature

ftr.SetType(miFeatureTypeSymbol);

// Get the point object from the feature

// and call the Set method

ftr.GetPoint().Set(X1, Y1);

// Add it to the layer

layers.Item("USA").AddFeature(ftr);

}

else {

AfxThrowOleException(CO_E_CLASS_CREATE_FAILED);

}

}

catch (COleDispatchException *e) {

e->ReportError();

e->Delete();

}

catch (COleException *e) {

e->ReportError();

e->Delete();

}

}}

410 MapX Reference

Page 425: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix A: MapX Error Codes

This is a table of the MapX errors encountered when writing MapX applications. For information on handling errors in Visual Basic, Delphi, and Powerbuilder, see the respective programmer's reference book and/or help system. For C++ programmers, see Working With Visual C++.

Error Description

1000 Out of memory.

1001 Property or method not implemented.

1002 Property not supported by themes of this type.

1003 Object is no longer valid.

1004 No object was found using the index you specified.

1005 Invalid DataSet type specified.

1006 Non-Unique Name specified. (Name already in use by another object).

1007 Invalid GeoField specified. Name not found, or index out of range.

1008 Invalid Secondary GeoField specified. Name not found, or index out of range.

1009 Unable to match a GeoField or BindLayer automatically.

1010 Invalid Fields parameter.

101 Unexpected error in MapX.

1012 Invalid Theme type specified.

1013 Unexpected error

1014 No key column was found in the specified dataset. Cannot create theme.

1015 The DataBinding process was cancelled by setting the cancel property in the ResolveDataBind event.

1016 Invalid aggregation function specified.

1017 No source field specified.

1018 Invalid field type specified.

1019 Unable to refresh dataset.

1020 Cannot find the BindLayer for this dataset. Unable to create theme.

1021 Unable to create theme.

1022 Invalid ranges.

Page 426: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix A: MapX Error Codes

1023 Invalid number of ranges.

1024 Theme categories cannot be removed.

1025 Invalid distribution method.

1026 Invalid fill pattern.

1027 Invalid pen style.

1028 Invalid Fields Parameter - Name or index of a field not found.

1029 Could not create a default theme.

1030 This property is available at design time only

1031 Layer specified is not matchable.

1032 Matched or specified Layer is not in any GeoSets.

1033 Invalid Name parameter specified.

1034 The color you specified is invalid.

1035 Invalid Spread by value.

1036 Invalid pen width.

1037 The Coordinate specified was not within the bounds of the map's Numeric CoordSys.

1038 Invalid Zoom specified. Zoom must be > 0.

1039 Invalid Tool specified. The tool number is invalid or doesn't exist, or the tool type or cursor is invalid.

1040 Invalid paper unit specified.

1041 Invalid mouse pointer specified.

1042 Invalid export format specified.

1043 Unable to create specified file.

1044 An ODBC error has occurred: <error>.

1045 Invalid ODBCQueryInfo object specified. Object not of correct type or SqlQuery not specified.

1046 Property not supported for annotations of this type.

1047 Invalid character code. Value must be between 0 and 255.

1048 Cannot create a theme of this type based on an attribute data column that has been aggregated by individual value.

1049 Invalid Row Parameter: Row out of range, or fetch past end of table.

1050 Invalid Column Parameter.

Error Description

412 MapX Reference

Page 427: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix A: MapX Error Codes

1051 Unable to find or load MIODBC.DLL

1052 Error initializing MIODBC.DLL Check DLL version.

1053 MIODBC.DLL called with an invalid handle.

1054 Dataset has no fields. No fields were successfully added to the dataset from the source data.

1055 Unable to obtain a temporary directory.

1056 Unable to create a filename for the new layer

1057 Key column not specified, cannot create new layer.

1058 The specified reference layer is not installed in the geodictionary.

1059 Unable to create new layer. Layer filename may already exist.

1060 Invalid bind layer type specified.

1061 Invalid bind layer specified.

1062 Unable to complete this type of bind with the reference column(s) specified.

1063 Unknown error creating map.

1064 Invalid Search Time specified. Time must be between 1 and 3600 seconds.

1065 Display unit specified was not valid .

1066 Inalid Conversion Constant specified.

1067 Missing or Invalid Source, or Source doesn't match Type specified.

1068 The specified reference layer is not a point reference layer

1069 Invalid dot size.

1070 Invalid position.

1071 The maximum size for a point theme object is 48.

1072 Unable to create geotable.

1073 Unable to create map layer.

1074 Unable to set or retrieve layer information.

1075 Unable to set or retrieve label information.

1076 Unable to set or retrieve layer style information.

1077 Unable to set or retrieve label style information.

1078 Feature object is no longer valid.

1079 Unable to find or load Helper Dialog DLL.

Error Description

Mapx Referenc 413

Page 428: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix A: MapX Error Codes

1080 Error initializing Helper Dialog DLL. Check DLL version.

1081 For the geofield specified or auto detected a secondary geofield is required, and one was not specified or auto detected.

1082 Fields Add or Remove not allowed after dataset has been created.

1083 Property or Method not supported by layers of this type.

1084 A Lotus Notes error has occurred: <error>.

1085 Invalid NotesViewInfo object specified. Object not of correct type or Database or View not specified.

1086 A numeric overflow or underflow has occurred during a coordinate conversion. Under Windows95, all coordinates are limited to the range of -32767 to +32767. The actual screen or map coordinates may be in range, but the conversion overflowed. See IsPointVisible or ClipLine.

1087 Attempt to set the Animation Layer to an object which is not a valid layer object.

1088 Invalid Filespec parameter.

1089 Invalid DataSet specified.

1090 Feature Type Invalid or not applicable.

1091 Operation not allowed on a standalone feature object.

1092 Error updating feature object.

1093 Error adding feature object.

1094 Error deleting feature object.

1095 Feature property or method not valid for feature type.

1096 Error reading Feature from layer.

1097 A line must have at least 2 points. A region must have at least 3 points.

1098 Invalid rectangle specified.

1099 Cannot find a specified Field in the DataSet.

1100 Invalid Features object.

1101 Invalid Search type specified.

1102 Invalid Search precision specified.

1103 Invalid Points object.

1104 Invalid Point object.

1105 Invalid Style object.

Error Description

414 MapX Reference

Page 429: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix A: MapX Error Codes

1106 Attempt to use a new Symbol or Text feature object without first setting the Point property

1107 Invalid Area unit specified.

1108 Every Feature in a Features collection object must be from the same layer.

1109 Key field not found in layer.

1110 The Layer that the Feature or Features object is from is no longer valid.

1111 Variant could not be converted to the appropriate type.

1112 The reference layer specified has no matchable columns, and thereforcannot be used as a reference layer.

1113 Creating bitmap image failed on map export.

1114 Invalid Circle Type specified.

1115 Resolution must be >= 3

1116 Invalid Datum object.

1117 Invalid CoordSys object.

1118 Invalid units specified.

1119 Invalid origin longitude specified.

1120 Invalid origin latitude specified.

1121 Invalid standard parallel #1 specified.

1122 Invalid standard parallel #2 specified.

1123 Invalid azimuth specified.

1124 Invalid scale factor specified.

1125 Invalid false easting specified.

1126 Invalid false northing specified.

1127 Invalid range specified.

1128 Invalid bounds specified.

1129 Invalid AffineInfo object.

1130 Datum has not been specified.

1131 Units have not been specified.

1132 Origin longitude has not been specified.

1133 Origin latitude has not been specified.

1134 Standard parallel #1 has not been specified.

Error Description

Mapx Referenc 415

Page 430: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix A: MapX Error Codes

1135 Standard parallel #2 has not been specified.

1136 Azimuth has not been specified.

1137 Scale factor has not been specified.

1138 False easting has not been specified.

1139 False northing has not been specified.

1140 Range has not been specified.

1141 Bounds have not been specified.

1142 Invalid CoordSys type specified.

1143 Invalid AffineTransform object.

1144 Degenerate AffineTransform specified.

1145 Custom dataset error.

1146 The map contains no layers. The Geoset was not saved.

1147 The map contains temporary or userdraw layers. Those layers were not included in the saved Geoset.

1148 Dataset type does not support dynamic column binding.

1149 Style object does not support bitmap symbols.

1150 Invalid symbol type specified.

1151 Attempt to restore a dataset by name for which there was no saved dataset.

1152 Custom dataset error. Method failed: IMMapXColumnInfoContainer::GetColumnInfoEnumerator.

1153 Custom dataset error. Method failed: IMEnumMapXColumnInfo::Reset.

1154 Custom dataset error. Required interface not supported: IMMapXColumnInfoContainer.

1155 Custom dataset error. Method failed: IMMapXColumnInfo::GetColumnName.

1156 Custom dataset error. Method failed: IMMapXColumnInfo::GetColumnNumber.

1157 Custom dataset error. Method failed: IMMapXColumnInfo::GetDataType.

1158 Custom dataset error. A column contains an unsupported type.

1159 Custom dataset error. Method failed: IMMapXDataset::GetSample.

1160 Custom dataset error. Method failed: IMMapXStaticDataset::BeginFetch.

Error Description

416 MapX Reference

Page 431: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix A: MapX Error Codes

1161 Custom dataset error. Method failed: IMMapXStaticDataset::FetchData.

1162 Custom dataset error. Method failed: IMMapXStaticDataset::EndFetch.

1163 Custom dataset error. Method failed: IMMapXDynamicDataset::FetchData.

1164 Custom dataset error. Method failed: IMMapXDataset:Init.

1165 Custom dataset error. Could not find a CLSID for the type of custom dataset specified. Check that the custom dataset is properly registered.

1166 Custom dataset error. Could not create the custom dataset object. Check that the custom dataset is properly registered.

1167 Operation not allowed due to license restrictions.

1168 Unable to open one of the Drilldown component tables.

1169 Unable to reset Drilldown layer to specified level.

1170 The Feature is too complex. There are too many parts or points in the Feature object.

1171 A Line or Region Feature must have at least 1 Part.

1172 The stand-alone Feature object is not attached to the map. Use Feature.Attach() before other Feature methods or properties.

1173 Unable to attach Feature to the map. Make sure Map object is valid.

1174 Error creating buffer.

1175 Operation not allowed on an empty Features collection.

1176 Invalid parameter combination.

1177 Invalid Caption parameter specified.

1178 Invalid Intersection Point flag specified.

1179 Invalid Intersection Test flag specified.

1180 Error Combining Features

1181 Invalid Arc Distance specified.

1182 Invalid Angle specified.

1183 Missing or Invalid RefineBoundary specified in Search method.

1184 XY and PointRef datasets are not allowed with dynamic binding.

1185 Custom dataset error. Required interface not supported.

1186 Custom dataset error. GetSample must return an array.

1187 Custom dataset error. Unsupported type returned.

Error Description

Mapx Referenc 417

Page 432: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix A: MapX Error Codes

1188 Error saving geoset.

1189 Unable to find file <file> needed by the coordsys dialog.

1190 Layer.UpdateFeature(Target, Source) - 'Target' must be a feature from 'Layer'.

1191 Range and individual value themes are not available on SpatialWare layers.

1192 The find method is not available on SpatialWare layers.

1193 Operation not allowed on a map with no layers.

1194 Empty Text Annotations not allowed.

1195 Failed adding key <key> from drilldown level <level>; possibly others failed. Key Field not indexed?

1196 Failed removing key <key> from drilldown level <level>; possibly others failed.

1197 Invalid minimum zoom value specified. Zoom values must be greater than zero.

1198 Invalid maximum zoom value specified. Zoom values must be greater than zero.

1199 Setting Value not allowed unless ComputeTheme is false.

1200 Invalid style unit value specified.

1201 Cannot add a theme of type miThemeNone.

1202 The ShowCount property is only supported for ranged and individual value themes.

1203 The maps display coordinate system cannot be modified while the map contains visible raster layers.

1204 This line style does not support interleaved styles.

1205 No feature was found using the name you specified.

1206 The AllOthersText property is only supported for ranged and individual value themes.

1207 Invalid Match Threshold specified. Percentage must be between 1 and 100.

1208 The ShowCount property cannot be set to true, when ComputeTheme is false.

1209 The text font size property cannot be changed, when overriding a layer style.

1210 Invalid cache option.

Error Description

418 MapX Reference

Page 433: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix A: MapX Error Codes

121 Cannot load specified cursor

1212 Error occurred while searching within a layer.

1213 Error occurred while updating or drawing the selection.

1214 Invalid feature ID.

1215 Unable to retrieve or set the theme style information.

1216 Error while accessing thematic object.

1217 Error occurred while creating the theme.

1218 Error occurred while accessing the thematic modifier.

1219 Error occurred while recalculating the theme.

1220 The theme ranges are invalid. Please verify that the ranges do not overlap. You may want to set AutoRecompute to FALSE when setting custom theme ranges.

1221 This property or method is only supported for themes with custom ranges.

1222 Invalid theme category index specified.

1223 This property or method is not supported for the all others category.

1224 Invalid Layer MBRSearch option specified.

1225 Invalid predominant object type.

1226 Operation not allowed on this datasets collection.

1227 Dataset created without SourceRow information. See Datasets.BuildSourceRows.

1228 This property or method is only supported when ComputeTheme is false.

1229 Error occurred while setting the number of categories for the theme.

1230 A file named <filename> already exists.

1231 Unable to open file <filename>. Verify that the file exists and that you have sufficient access rights to open it.

1232 Unable to open file <filename>. Verify that the file exists in either the geodictionary directory or on the list of search paths. Also make sure that you have sufficient access rights to open it.

1233 Error writing file during export.

1234 Invalid BeginAccessType or Invalid EndAccessType.

1235 Theme value must be positive.

1236 This property is not supported for stacked bar charts.

Error Description

Mapx Referenc 419

Page 434: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix A: MapX Error Codes

1237 This property is only supported for stacked bar charts.

1238 The GraduateSizeBy property is only supported for graduated stacked bar charts and for bar charts which are not stacked or independently scaled.

1239 Invalid LayerInfo parameter specified.

1240 Error adding LayerInfo parameter.

1241 Expected LayerInfo parameter <parameter name> is either missing or invalid.

1242 Couldn't open <table name>. Table not found in the geodictionary.

1243 This property is not supported for the current symbol type. The symbol type must match the type of symbol for which you are changing properties.

1244 Theme deserialization error occurred.

1245 Theme serialization error occurred.

1246 Theme recreation error occurred.

1247 Cannot modify layer. Table may be readonly.

1248 Invalid Expression Parameter specified.

1249 Error occurred while creating the legend.

1250 Legend deserialization error occurred.

1251 Legend serialization error occurred.

1252 Legend recreation error occurred.

1253 Table is not mappable. Make sure table has an object column. If table is a server table, make sure that there is an entry in the mapinfo mapcatalog for it.

1254 Invalid closematch max value specified. Closematch values must be greater than or equal to zero.

1255 Invalid rounding value specified.

1256 This property can only be set when the RoundRanges property is set to true.

1257 This property can only be set when the SpreadBy property is set to miSpreadByColor.

1258 This property can only be set when the InflectRanges property is set to true.

1259 An invalid inflection range index was specified.

Error Description

420 MapX Reference

Page 435: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix A: MapX Error Codes

1260 Not enough ranges to use inflection. There must be at least three ranges to use inflection.

1261 An invalid apply attribute was specified.

1262 Cannot apply size attributes on a layer which predominantly contains bounded objects or text objects.

1263 Cannot spread by size on a layer which predominantly contains bounded objects or text objects.

1264 Cannot spread by color when applying size attributes.

1265 Cannot spread by size when applying color attributes.

1266 Cannot apply size attributes on an individual value theme.

1267 Invalid label max value specified. Label max values must be between 0 and 32767.

1268 Attempt to set the Insertion Layer to an object which is not a valid layer object.

1269 Invalid RowValue object specified.

1270 Invalid RowValues object specified.

1271 Invalid UpdateFeature parameter specified.

1272 Error occurred while setting the current tool to a standard tool.

1273 The insertion layer is not set. The insertion layer must be set before the object creation tools can be used.

1274 Error occurred while setting the current tool to a custom tool.

1275 Error occurred while creating a standard tool.

1276 Error occurred while creating a custom tool.

1277 Cannot create a theme automatically on Seamless table.

1278 Invalid Key Specified.

1279 The layer that was specified is read-only. A read-only layer cannot be editable.

1280 The layer that was specified is not editable. The insertion layer can only be set to a layer that is editable.

1281 The layer specified does not contain any area objects. Centroids can only be shown for layers that contain bounded area objects.

1282 The layer specified does not contain any line objects. Line direction can only be shown for layers that contain line objects.

Error Description

Mapx Referenc 421

Page 436: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix A: MapX Error Codes

1283 The layer specified does not contain any point objects or area objects. Nodes can only be shown for layers that contain point objects or bounded area objects.

1284 Invalid layer specified. Cannot set the insertion layer to a drilldown, raster, seamless, or user draw layer.

1285 Invalid Field specified. Name not found, or index out of range.

1286 Error accessing the insertion tools for the map.

1287 The editable property for the insertion layer cannot be set to false.

Error Description

422 MapX Reference

Page 437: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix B: Constants

Here are the MapX constants:

AggregationFunctionConstants AnnotationChangedTypeConstants

AnnotationTypeConstants ApplyAttributeConstants

AreaUnitConstants BindLayerTypeConstants

CircleTypeConstants ColorConstants

ColorSpreadingMethodConstants ConversionConstants

CoordSysTypeConstants CursorConstants

DatasetTypeConstants DistribMethodConstants

DotSizeConstants ExportFormatConstants

FeatureTypeConstants FieldTypeConstants

FillPatternConstants Graduation Constants

IntersectionPointConstants IntersectionTestConstants

LineTypeConstants LayerBeginAccessConstants

LayerEndAccessConstants LayerInfoTypeConstants

LayerSrvLayerOptions LayerTypeConstants

MapDrawConstants MapUnitConstants

MouseWheelSupportConstants PaperUnitConstants

PenStyleConstants PolyToolFlagConstants

PositionConstants ResolveDataBindConstants

SearchTypeConstants SelectionTypeConstants

SpreadByConstants StyleUnitConstants

SymbolTypeConstants ThemeTypeConstants

ToolConstants ToolFlagConstants

ToolTypeConstants

Page 438: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

AggregationFunctionConstants

AggregationFunctionConstantsmiAggregationSum = 0

miAggregationAverage = 1

miAggregationCount = 2

miAggregationIndividual = 4

miAggregationAuto = 5

AnnotationChangedTypeConstantsmiAddAnnotation = 0

miDeleteAnnotation = 1

miSelectAnnotation = 2

miEditAnnotation = 3

AnnotationTypeConstantsmiSymbolAnnotation = 1

miTextAnnotation = 6

ApplyAttributeConstantsmiApplyAttributeAll = 0

miApplyAttributeColor = 1

miApplyAttributeSize = 2

AreaUnitConstantsmiUnitSquareMile = 14

miUnitSquareKilometer = 15

miUnitSquareInch = 16

miUnitSquareFoot = 17

miUnitSquareYard = 18

miUnitSquareMillimeter = 19

miUnitSquareCentimeter = 20

424 MapX Reference

Page 439: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

BindLayerTypeConstants

miUnitSquareMeter = 21

miUnitSquareSurveyFoot = 22

miUnitSquareNauticalMile = 23

miUnitSquareTwip = 24

miUnitSquarePoint = 25

miUnitSquarePica = 26

miUnitSquareDegree = 27

miUnitAcre = 28

miUnitHectare = 29

miUnitSquareLink = 33

miUnitSquareChain = 34

miUnitSquareRod = 35

miUnitPerch = 36

miUnitRood = 37

BindLayerTypeConstantsmiBindLayerTypeNormal = 0

miBindLayerTypeXY = 1

miBindLayerTypePointRef = 2

Mapx Referenc 425

Page 440: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

CircleTypeConstants

CircleTypeConstants

ColorConstantsNote: These numbers represent OLE_COLOR values (BGR), which can be assigned to

properties such as Style.LineColor. When specifying colors in a geoset, use RGB color settings instead.

miColorBlack = 0

miColorRed = 255

miColorGreen = 65280

miColorBlue = 16711680

miColorMagenta = 16711935

miColorCyan = 16776960

miColorWhite = 16777215

miColorLightGray = 12632256

miColorDarkGray = 4210752

miColorGray = 8421504

miColorPaleYellow = 13697023

miColorLightYellow = 8454143

miColorYellow = 65535

miColorLimeGreen = 12639424

Constant Value Description

miCircleTypeScreen 0 The CreateCircularRegion method creates a region that appears circular on the screen. However, different points on the circle might not be the same geographic distance from the center of the circle.

miCircleTypeMap 1 The CreateCircularRegion method creates a region whose points are all the same geographic distance from the center. However, depending on which display coordinate system and projection are in use, the region might appear distorted, rather than ”circular.”

426 MapX Reference

Page 441: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ColorConstants

miColorTeal = 8421440

miColorDarkGreen = 16384

miColorMaroon = 128

miColorPurple = 8388736

miColorOrange = 33023

miColorKhaki = 7051175

miColorOlive = 32896

miColorBrown = 4210816

miColorNavy = 8404992

miColorScrollBars = 0x80000000

miColorDesktop = 0x80000001

miColorActiveTitleBar = 0x80000002

miColorInactiveTitleBar = 0x80000003

miColorMenuBar = 0x80000004

miColorWindowBackground = 0x80000005

miColorWindowFrame = 0x80000006

miColorMenuText = 0x80000007

miColorWindowText = 0x80000008

miColorTitleBarText = 0x80000009

miColorActiveBorder = 0x8000000A

miColorInactiveBorder = 0x8000000B

miColorApplicationWorkspace = 0x8000000C

miColorHighlight = 0x8000000D

miColorHighlightText = 0x8000000E

miColorButtonFace = 0x8000000F

miColorButtonShadow = 0x80000010

miColorGrayText = 0x8000001

miColorButtonText = 0x80000012

miColorInactiveCaptionText = 0x80000013

miColor3DHighlight = 0x80000014

miColor3DDarkShadow = 0x80000015

Mapx Referenc 427

Page 442: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ColorSpreadingMethodConstants

miColor3DLight = 0x80000016

miColorInfoText = 0x80000017

miColorInfoBackground = 0x80000018

ColorSpreadingMethodConstantsmiColorMethodRGB = 0

miColorMethodHSV = 1

ConversionConstantsmiMapToScreen = 0

miScreenToMap = 1

428 MapX Reference

Page 443: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

CoordSysTypeConstants

CoordSysTypeConstants

Constant Value Description

miAlbersEqualAreaConic 9

miAzimuthalEquidistant 5 Polar aspect only

miCylindricalEqualArea 2

miEckertIV 14

miEckertVI 15

miEquidistantConic 6 Also known as Simple Conic

miGall 17

miHotineObliqueMercator 7

miLambertAzimuthalEqualArea 4 Polar aspect only

miLambertConformalConic 3

miLambertConformalConicBelgium 19 Modified for Belgium 1972

miLongLat 1 Longitude/Latitude

miMercator 10

miMillerCylindrical 11

miMollweide 13

miNewZealandMapGrid 18

miNonEarth 0 Unprojected; cartesian coords.

miRobinson 12

miSinusoidal 16

miStereographic 20

miSwissObliqueMercator 25

miTransverseMercator 8 Also known as Gauss-Kruger

miTransverseMercatorDenmarkS34J 21 Modified for Danish System 34 Jylland-Fyn

miTransverseMercatorDenmarkS34S 22 Modified for Sjaelland

miTransverseMercatorDenmarkS45B 23 Modified for Danish System 45 Bornholm

miTransverseMercatorFinland 24 Modified for Finnish KKJ

Mapx Referenc 429

Page 444: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

CursorConstants

CursorConstantsmiDefaultCursor = 0

miArrowCursor = 1

miCrossCursor = 2

miIBeamCursor = 3

miIconCursor = 4

miSizeCursor = 5

miSizeNESWCursor = 6

miSizeNSCursor = 7

miSizeNWSECursor = 8

miSizeEWCursor = 9

miUpArrowCursor = 10

miHourglassCursor = 11

miNoDropCursor = 12

miArrowHourglassCursor = 13

miArrowQuestionCursor = 14

miSizeAllCursor = 15

miArrowToolCursor = 16

miPanCursor = 17

miCenterCursor = 18

miZoomInCursor = 19

miZoomOutCursor = 20

miSymbolCursor = 21

miTextCursor = 22

miSelectCursor = 23

miRadiusSelectCursor = 24

miRectSelectCursor = 25

miRegionSelectCursor = 26

miInfoCursor = 27

miSelectPlusCursor = 28

miSelectRadiusPlusCursor = 29

430 MapX Reference

Page 445: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DatasetTypeConstants

miSelectRectPlusCursor = 30

miSelectRegionPlusCursor = 31

miSelectMinusCursor = 32

miSelectRadiusMinusCursor = 33

miSelectRectMinusCursor = 34

miSelectRegionMinusCursor = 35

miLabelCursor = 36

miDrillDownExpandCursor = 37

miDrillDownContractCursor = 38

miCustomCursor = 39

DatasetTypeConstantsmiDataSetDAO = 1

miDataSetODBC = 2

miDataSetUnbound = 3

miDataSetGlobalHandle = 4

miDataSetOLEData = 5

miDataSetLayer = 6

miDataSetNotesView = 7

miDataSetNotesQuery = 8

miDataSetSafeArray = 9

miDataSetOEO = 10

miDataSetDelphi = 1010

miDataSetDelphi4 = 101

miDataSetADO = 12

miDataSetRDO = 13

Mapx Referenc 431

Page 446: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

DistribMethodConstants

DistribMethodConstantsmiCustomRanges = 0

miEqualCountPerRange = 1

miEqualRangeSize = 2

miNaturalBreak = 3

miStandardDeviation = 4

DotSizeConstantsmiDotSizeSmall = 0

miDotSizeLarge = 1

ExportFormatConstantsmiFormatWMF = 0

miFormatBMP = 1

miFormatGIF = 2

miFormatJPEG = 3

miFormatTIF = 4

miFormatPNG = 5

miFormatPSD = 6

FeatureTypeConstantsmiFeatureTypeRegion = 0

miFeatureTypeLine = 1

miFeatureTypeSymbol = 2

miFeatureTypeMixed = 3

miFeatureTypeUnknown = 4

miFeatureTypeText = 5

miFeatureTypeNull = 6

432 MapX Reference

Page 447: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

FieldTypeConstants

FieldTypeConstantsmiTypeString = 0

miTypeNumeric = 1

FillPatternConstantsmiPatternNoFill = 0

miPatternHollow = 1

miPatternSolid = 2

miPatternHorizontal = 3

miPatternVertical = 4

miPatternFDiag = 5

miPatternFilBDiag = 6

miPatternCross = 7

miPatternDiagCross = 8

Graduation ConstantsmiGraduateBySquareRoot = 0

miGraduateByConstant = 1

miGraduateByLogarithm = 2

IntersectionPointConstantsmiIntersectCrossings = 9

miIntersectCommon = 10

miIntersectAll = 11

Mapx Referenc 433

Page 448: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

IntersectionTestConstants

IntersectionTestConstantsmiIntersectCentroidWithinFeature = 0

miIntersectFeature = 1

miIntersectEntirelyWithinFeature = 2

LineTypeConstantsmiLineTypeNone = 0

miLineTypeSimple = 1

miLineTypeArrow = 2

LayerBeginAccessConstantsmiAccessRead= 0,

miAccessReadWrite = 1

LayerEndAccessConstantsmiAccessEnd= 0,

LayerInfoTypeConstantsmiLayerInfoTypeTab = 0

miLayerInfoTypeUserDraw = 1

miLayerInfoTypeRaster = 2

miLayerInfoTypeShape = 3

miLayerInfoTypeServer = 4

miLayerInfoTypeGeodictUserName = 5

LayerSrvLayerOptionsmiLayerCacheOn = 0

miLayerCacheOff = 1

miLayerMBRSearchOn = 0

miLayerMBRSearchOff = 2

434 MapX Reference

Page 449: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

LayerTypeConstants

LayerTypeConstantsmiLayerTypeNormal = 0

miLayerTypeRaster = 2

miLayerTypeSeamless = 4

miLayerTypeUnknown = 5

miLayerTypeUserDraw = 6

miLayerTypeDrilldown = 7

MapDrawConstantsmiDrawBegin = 1

miDrawEnd = 2

MapUnitConstantsmiUnitMile = 0

miUnitKilometer = 1

miUnitInch = 2

miUnitFoot = 3

miUnitYard = 4

miUnitMillimeter = 5

miUnitCentimeter = 6

miUnitMeter = 7

miUnitSurveyFoot = 8

miUnitNauticalMile = 9

miUnitTwip = 10

miUnitPoint = 1

miUnitPica = 12

miUnitDegree = 13

miUnitLink = 30

miUnitChain = 31

miUnitRod = 32

Mapx Referenc 435

Page 450: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

MouseWheelSupportConstants

MouseWheelSupportConstantsmiNoMousewheelSupport = 1

miMousewheelNoAutoScroll = 2

miFullMousewheelSupport = 3

PaperUnitConstantsmiPaperUnitMile = 0

miPaperUnitKilometer = 1

miPaperUnitInch = 2

miPaperUnitFoot = 3

miPaperUnitYard = 4

miPaperUnitMillimeter = 5

miPaperUnitCentimeter = 6

miPaperUnitMeter = 7

miPaperUnitSurveyFoot = 8

miPaperUnitNauticalMile = 9

miPaperUnitTwip = 10

miPaperUnitPoint = 11

miPaperUnitPica = 12

miPaperUnitDegree = 13

miPaperUnitLink = 30

miPaperUnitChain = 31

miPaperUnitRod = 32

PenStyleConstantsmiPenNone = 0

miPenSolid = 1

Note:Other pen styles are available, although constants have not been defined for those styles; see

Style.LineStyle property

436 MapX Reference

Page 451: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

PolyToolFlagConstants

PolyToolFlagConstantsmiPolyToolBegin = 0

miPolyToolEnd = 1

miPolyToolEndEscaped = 2

miPolyToolInProgress = 3

PositionConstantsmiPositionCC = 0

miPositionTL = 1

miPositionTC = 2

miPositionTR = 3

miPositionCL = 4

miPositionCR = 5

miPositionBL = 6

miPositionBC = 7

miPositionBR = 8

ResolveDataBindConstantsmiChooseField = 0

miChooseLayer = 1

miChooseGeoSet = 2

SearchTypeConstantsmiSearchTypeCentroidWithin = 0

miSearchTypePartiallyWithin = 1

miSearchTypeEntirelyWithin = 2

Mapx Referenc 437

Page 452: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

SelectionTypeConstants

SelectionTypeConstantsmiSelectionNew = 0

miSelectionAppend = 1

miSelectionRemove = 2

SpreadByConstantsmiSpreadByColor = 1

miSpreadByNone = 0

miSpreadBySize = 2

StyleUnitConstantsmiStyleUnitPixel = 0

miStyleUnitTenthsOfPoint = 1

SymbolTypeConstantsmiSymbolTypeBitmap = 1

miSymbolTypeTrueTypeFont = 0

miSymbolTypeVector = 2

ThemeTypeConstantsmiThemeRanged = 0

miThemeBarChart = 1

miThemePieChart = 2

miThemeGradSymbol = 3

miThemeDotDensity = 4

miThemeIndividualValue = 5

miThemeAuto = 6

miThemeNone = 9

438 MapX Reference

Page 453: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ToolConstants

ToolConstantsmiArrowTool = 1000

miPanTool = 1001

miCenterTool = 1002

miZoomInTool = 1003

miZoomOutTool = 1004

miSymbolTool = 1005

miTextTool = 1006

miSelectTool = 1007

miRadiusSelectTool = 1008

miRectSelectTool = 1009

miPolygonSelectTool = 1010

miLabelTool = 101

miAddLineTool = 1012,

miAddPolylineTool = 1013,

miAddRegionTool = 1014,

miAddPointTool = 1015

ToolFlagConstantsmiToolBegin = 0,

miToolEnd = 1,

miToolEndEscaped = 2,

miToolInProgress = 3

ToolTypeConstantsmiToolTypePoint = 0

miToolTypeLine = 1

miToolTypeCircle = 2

miToolTypeMarquee = 3

miToolTypePoly = 4

miToolTypePolygon = 5

Mapx Referenc 439

Page 454: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

ToolTypeConstants

440 MapX Reference

Page 455: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix C: Creating Expressions

Expressions in MapX are useful for several reasons. The Layer.Search method can be used to select a subset of a layer's features based on an expression. In this case, the expression should evaluate to a boolean value, e.g. "year(Received) = 1990 and month(Received) > 4".

The Dataset.AddField method uses expressions to create a new field by applying an expression to the existing columns. These expressions can evaluate to a numerical or string value, as in "Female_Pop + Male_Pop" or "Proper$(City) + "", "" + UCase$(State)"

Expressions are formed using column (or field) names and constants (i.e. specific data values), along with functions and operators which act upon the columns and constants.

String constants in expressions should be enclosed in double quotes so that MapX knows to treat it as a string, rather than thinking it is a column name.

Dates consist of a month, a day, and an optional year. The year is specified by two or four digits. The entire date string should be enclosed in double quotes. The components of a date can be separated by hyphens or slashes.

Operators

Mathematical operators

Note that you can:• Add numbers to dates to yield another date.• Subtract a number from a date to yield another date.• Subtract a date from a date to yield a number.

A + B + addition

A - B - subtraction

–A (negative) - negation

A * B * multiplication

A / B / division

A\B \ integer division

A ^ B ^ exponentiation

Page 456: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Operators

When you add numbers to dates, or subtract numbers from dates, MapX treats the numbers as specifying a number of days. If you want to add or subtract a week, you would use the number 7. When you want to add or subtract a month, you could use 30 or 31. When MapX subtracts a date from a date, the resulting number indicates a number of days.

String operator

Note: Remember that string constants must be enclosed in double quotes.

Comparison operators

Numerical Comparison

Numerical comparisons are based on the numerical values of the expressions and numerical constants.

Example: All rows where the median age is 42.• MED_AGE=42

Note: This expression selects only those records where the median age is exactly 42. When your median age data contains a decimal portion (which is the case for MapInfo–supplied demographic data) then it is unlikely that there are many regions with a median age of exactly 42. In this case, you may want to use the Round function to search for records whose median age is approximately equal to 42.

String Comparison

String comparisons are based on the exact character content of the string. In this case “>” means “alphabetically greater than” (i.e. comes after in the alphabet) and “<” means “alphabetically less than.”

When typing a string constant into an expression, you should enclose it in quotes so that MapX knows to treat it as a string, rather than treating it as a column name.

& “concatenation” — connects strings and string expressions.

+ “concatenation” — connects strings and string expressions.

= “equals”

<> “not equals”

> “greater than”

< “less than”

>= “greater than or equal to”

<= “less than or equal to”

442 MapX Reference

Page 457: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Operators

Example: All rows where the vendor is Acme.• VENDOR=”Acme”

Note: The equal operator is case insensitive.

Date Comparison

Remember to enclose date constants in quotes and use the order Month, Day, Year.

Example: All received after October 9, 1991.• RECEIVED>”10–9–91”

Note: This expression does not select those received on October 9, 1991. When you want them as well, use the ">=" operator

• RECEIVED>=”10–9–91”

Example: Records for all received before August, no matter what year.

• Month(RECEIVED)<8

Logical Comparison

Example: All that have shipped.• Shipped

Note: The column “Shipped” is a logical column. It contains “T” for true, or yes, and “F” for false, or no. When an order is shipped, it is marked “T”. Otherwise, it is not shipped. For orders that are shipped, expression 27 evaluates to true. For orders not shipped it evaluates to false.

Example: All that have not shipped.• Str$(Shipped)=”F”• Not Shipped

Logical operators

“And”, “or”, and “not” are logical operators. You use them to combine expressions when using methods like Layer.Search.

For example, suppose you want to select all properties that are worth $250,000 or more and are in Columbia county. So, you would combine two simple expresssions using the "and" operator:

and is “true” if (and only if) both of its arguments (the expressions it joins together) are true. A record must satisfy both of these conditions if it is to be selected.

or is “true” if either one, or both, of its arguments (the expressions it joins together) are true. A record need satisfy only one of these conditions if it is to be selected. It is also selected if both of its conditions arsatisfied.

not is “true” if its argument (the expression it applies to) is false. A record is selected if it does not meet the stated condition.

Mapx Referenc 443

Page 458: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Operators

• COUNTY = ”Columbia” and VALUE >= 250000

Now, what if you want all properties worth $250,000 or more and not in Columbia county? You can use “not” to negate the first clause of the previous expression:

• not(COUNTY=”Columbia”) and VALUE>=250000

You can use “or” when you want to specify alternative conditions, such as:• COUNTY=”Columbia” or COUNTY=”Greene”

String Clauses

Example: All customers from N to Q.• LAST_NAME >= ”N” and LAST_NAME <”R”

Note: The first part of the expression checks for names that are either alphabetically equal to “n” or that are alphabetically greater than (after) “n”. The second part of the expression checks for names that are alphabetically less than (before) “r”. Any name starting with letters “n” through “q” satisfies this condition.

Example: All customers whose last name begins with C.• LAST_NAME>=”C” and LAST_NAME<”D”

Note: The logic of this expression is the same as the logic for expression 47.

Date Clauses

Example: Records for all received in August 1990• Month(RECEIVED)=8 and Year(RECEIVED)=1990

Note: In this expression we specify the year explicitly, using the “year(<somecolumn>)” function to extract it from the date.

Example: Records for all received in July or September of 1989• month(RECEIVED)=(7, 9) and year(RECEIVED)=89

Keywords

MapX supports the use of keywords "like" and “between”.

Consider the following example, which illustrates “between”:• PRICE between 50000 and 100000

You can also use between with character strings.

The keyword "like" is used for string pattern matching.• The underscore character matches a single character.• The percent character matches zero or more characters.

The comparison is case insensitive.

Example: To determine if a string starts with "South"• STATE like "South%"

444 MapX Reference

Page 459: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Operators

Operator Precedence

When MapX evaluates expressions it needs to know which components of an expression to evaluate first. This is called precedence. By convention, certain operators are assigned different levels of precedence. Those with the highest level are evaluated first. The following table lists MapX's operators in the order in which they are evaluated. Operators at the same level of precedence are evaluated from left to right, besides exponentiation, which evaluates from the right.

For example, the expression 3+4*2 produces a result of 11. That is because multiplication has a higher precedence than addition and is performed first. Parenthesis must be used to force MapX to do the addition first: (3+4)*2.

Now consider this expression, which is intended to select all records July or September of 1989.• year(RECEIVED)=89 and month(RECEIVED)=7 or month(RECEIVED)=9

Because “and” has higher precedence than “or”, MapX treats this expression as though “year(RECEIVED)=89 and month(RECEIVED)=7” was enclosed in parentheses. In this case, any record for July of 89 or for September of any year would be selected. That's probably not what you want. However, by adding parentheses to the second expression, you can get what you want:

• year(RECEIVED)=89 and (month(RECEIVED)=7 or month(RECEIVED)=9)

Note: When you are not sure how MapX evaluates an expression with several operators, you should use parentheses to group elements as you want them.

Highest Priority: parenthesis

exponentiation

negation

multiplication, division

addition, subtraction

geographic operators

comparison operators

Not

And

Lowest Priority: Or

Mapx Referenc 445

Page 460: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

FunctionsFunctions take data values and perform some operation on them to produce a new value. Functions have the following form:

SomeFunction(parameters)

Most of MapX's functions take one or two parameters. A parameter can be a column or it can be another expression.

MapX uses the keyword “obj” or “object” with the geographic functions: Area, CentroidX, CentroidY, ObjectLen, and Perimeter. This keyword tells MapX that it has to get values based on the graphical objects in the table rather than the tabular data.

Abs

Syntax: Abs(num_expr)

Action: Returns the absolute value of a numerical expression. When the expression has a value greater than zero, Abs returns that value. When the expression has a value less than zero, Abs returns a value equal to the value of the expression multiplied by negative one.

Acos

Syntax: Acos(num_expr)

Action: Returns the arc-cosine value of the numeric num_expr value. In other words, this returns the angle whose cosine is equal to num_expr.

The result returned represents an angle, expressed in radians. This angle will be somewhere between zero and Pi radians (given that Pi is approximately 3.14159, and given that Pi/2 radians represents 90 degrees).

Since cosine values range between one and minus one, the expression num_expr should represent a value no larger than one and no smaller than minus one.

Area

Syntax: Area(obj, units)

Action: Returns the area of the object. 0 is returned if the object has no area or there is no object for the record. Arcs, text, points, lines, and polylines do not have areas.

As with all the Geoobject functions, the first parameter should usually be the special column named obj. The second parameter is a string which denotes the units in which the area should be evaluated. The units available are:

Unit Name Unit Represented

“sq mi” square miles

“sq km” square kilometers

“sq in” square inches

446 MapX Reference

Page 461: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

Examples: To select all rows for objects that have an area greater that 59 square miles:• Area(obj,”sq mi”)>59

To select all rows for objects with a population density less than 250 people per square mile:• Population/Area(obj,”sq mi”)<250

Asc

Syntax: Asc(string_expr)

Action: Returns the character code representing the first character in the string specified by string_expr.

If string_expr is a null string, the Asc() function returns a value of zero.

On a system that supports double-byte character sets (e.g. Japanese Windows): if the first character of string_expr is a single-byte character, Asc() returns a number in the range 0 - 255; if the first character of string_expr is a double-byte character, Asc() returns a value in the range 256 - 65,535.

On systems that do not support double-byte character sets, Asc() returns a number in the range 0 - 255.

Asin

Syntax: Asin(num_expr)

Action: Returns the arc-sine of the numeric num_expr value. In other words, Asin() returns returns the angle whose sine is equal to num_expr.

“sq ft” square feet

“sq survey ft” square survey feet

“sq yd” square yards

“sq mm” square millimeters

“sq cm” square centimeters

“sq m” square meters

“sq ch” square chains

“sq li” square links

“sq rd” square rods

“perch” perches

“rood” roods

“acre” acres

“hectare” hectares

Unit Name Unit Represented

Mapx Referenc 447

Page 462: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

The result returned represents an angle, expressed in radians. This angle will be somewhere between -Pi/2 and Pi/2 radians (given that Pi is approximately equal to 3.14159, and given that Pi/2 radians represents 90 degrees).

Since sine values range between one and minus one, the expression num_expr should represent a value no larger than one and no smaller than minus one.

Atan

Syntax: Atan(num_expr)

Action: Returns the arc-tangent of the numeric num_exp . In other words, Atan() returns the anle whose tangent is equal to num_expr. The num_expr expression can have any numeric value.

The result returned from Atan represents an angle, expressed in radians, in the range -Pi/2 radians to Pi/2 radians.

Centroid

Syntax: Centroid(obj_expr)

Action: Returns a point object which is located at the centroid of the specified obj_expr object.

If the obj_expr parameter represents a point object, the Centroid() function returns the position of the point.

If the obj_expr parameter represents a line object, the Centroid() function returns the point midway between the ends of the line.

If the obj_expr parameter represents a polyline object, the Centroid() function returns a point located at the mid point of the middle segment of the polyline.

If the obj_expr parameter represents any other type of object, the Centroid() function returns a point located at the true centroid of the original object. For rectangle, arc, text, and ellipse objects, the centroid position is halfway between the upper and lower extents of the object, and halfway between the left and right extents. For region objects, however, the centroid position is always "on" the object in question, and therefore may not be located halfway between the object's extents.

CentroidX

Syntax: CentroidX(object)

Action: Returns the x coordinate of the centroid of the object, which is the longitude value for earth maps. The centroid is usually the center of the object's minimum bounding rectangle (MBR).

The value is in decimal degrees if the coordinates are latitudes and longitudes. The value is in whatever units were specified for the table if its coordinates are not latitudes and longitudes.

Example: To select all objects west of New York City:• CentroidX(obj)<–73.997890

CentroidY

Syntax: CentroidY(object)

448 MapX Reference

Page 463: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

Action: Returns the y centroid of the object, which is the latitude value for earth maps.

The value is in decimal degrees if the coordinates are latitudes and longitudes. The value is in whatever units were specified for the table if its coordinates are not latitudes and longitudes.

Example: To select all objects north of New York City:• CentroidY(obj)>40.750450

Chr$

Syntax: Chr$(num_expr)

Action: Chr$ interprets the value of num_expr as a character value. It returns the character corresponding to that value. Accordingly, num_expr should be an integer between 0 and 255.

Example: You might want to have labels with information on two lines. You can use Chr$ to insert a carriage return into a label expression. The ANSI value for a carriage return is 13. Assume that you want the first line of a label to be a country name and the second line of a label to be the county population. The following expression produces that result:

• Proper$(County)+Chr$(13)+Population

Note: Some other languages use the convention Chr$(10) to represent a line feed. MapX allows you to specify either Chr$(13) or Chr$(10).

Cos

Syntax: Cos(num_expr)

Action: The Cos function returns the cosine of the value of a numeric expression, where that expression represents an angle expressed in radians.

CurDate

Syntax: CurDate()

Action: Returns a date value representing the current date.

Example: To select all received 30 or more days ago:• Received<=CurDate()–30

Day

Syntax: Day(datefield)

Action: Returns the day of the month from the date. The day is represented as an integer from one (1) to thirty–one (31).

Examples: To select all rows where the date is the first of the month:• Day(date)=1

To select all rows where the day is Friday and the date is not the thirteenth:• Weekday(date)=6 and Day(date)<>13

Mapx Referenc 449

Page 464: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

Distance

Syntax: Distance(x1, y1, x2, y2, units)• x1 and y1 are East–West (Longitude) coordinates for earth maps• x2 and y2 are North–South (Latitude) coordinates for earth maps• units is the current distance unit

Action: Calculates the distance between two points.

The units parameter should be a string constant to specify what units the returned distance should be in. The units available are:

Examples: To calculate the distance between some objects and New York City, which is located at –73.997890 longitude and 40.750450 latitude:

• Distance(–73.997890, 40.750450, CentroidX(obj), CentroidY(obj),”mi”)

Exp

Syntax: Exp(num_expr)

Action: Returns the mathematical value e to the power represented by num_expr. e has a value of approximately 2.7182818.

Note that MapX expressions support general exponentiation throught the caret operator (^).

Unit Name Unit Represented

“mi” miles

“km” kilometers

“yd” yards

“mm” millimeters

“cm” centimeters

“m” meters

“nmi” nautical miles (1 nautical mile represents 1852 meters)

450 MapX Reference

Page 465: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

Fix

Syntax: Fix(num_expr)

Action: Removes the fractional protion of a number, and returns the resultant integer value.

The Fix() function is similar to, but not identical to, the Int() function. The two functions differ in the way that they treat negative fractional values. When passed a negative fractional number, Fix() returns the nearest integer falue greater than or equal to the original value; thus, the function call:

Fix(-2.3)

returns a value of -2. But when the Int() function is passed a negative fractional number, it returns the nearest integer value that is less than or equal to the original value. Thus, the function call:

Int(-2.3)

returns a value of -3.

InStr

Syntax: InStr(position, string, substring)

Action: InStr tests whether of not some string has a specific substring. MapX searches string starting at the character position specified by position. When position is one, MapX starts searching at the beginning of string. When it has a value of six, MapX starts searching at the sixth character in string.

When string contains substring, InStr returns the character position wher substring starts. When string does not contain substring, InStr returns zero.

Example: You are preparing to geocode a file and you want to identify all the entries with Post Office boxes for addresses. That means you want all entries that have the string “box” in their address column. They may also have “P.O.”, but you cannot be sure of that. Nor can you be sure of how “box” is capitalized in the entries. Here is the appropriate expression:

• InStr(1,UCase$(Address),”BOX”)>0

This expression directs MapX to search the Address column for the string “BOX”. All entries containing this string are selected.

Int

Syntax: Int(num_expr)

Action: Returns the nearest integer that is less than or equal to the specified value (num_expr).

Mapx Referenc 451

Page 466: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

Examples: The following table shows how Int treats various values:

LCase$

Syntax: LCase$(string)

Action: Returns the lower case of the string.

Examples: Consider the following expression:• LCase$(City)

The following table shows how it converts an input string (from a column in your table) into a returned string:

Left$

Syntax: Left$(string, number)

Action: Returns a string that consists of the leftmost number of characters in string.

Examples: The following table shows how Left$() acts with a number parameter of 5:

Now consider the following expression, where Phone is a column containing telephone numbers prefixed by area codes:

• Left$(Phone,3)=”404”

This expression selects all rows where the first three digits of the phone number are “404”. Note that the Phone column contains character data and therefore the comparison value, 404, has to be in quotes so MapX knows to treat it as a character string.

Number Int(Number)

5.2 5

5.999 5

–7.8 –8

–7.2 –8

Input String Returned String

NEW YORK new york

New yorK new york

new york new york

String Left$(String, 5)

New York New Y

Denver Denve

Singapore Singa

452 MapX Reference

Page 467: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

Log

Syntax: Log(num_expr)

Action: Returns the natural logarithm of the numeric expression specified by the num_expr parameter.

The natural logarithm represents the number to which the mathemactical value e must be raised in order to obtain num_expr. e has a value of approximately 2.7182818.

The logarithm is only defined for positive numbers; accordingly, the Log() function will generate an error if num_expr has a negative value.

You can calculate logarithmic values in other bases (e.g. base 10) using the natural logarithm. Tobtain the base-10 logarithm of the number n, difide the natural log of n ( Log(n) ) by the natural logarithm of 10 ( Log(10) ).

LTrim$

Syntax: LTrim$(string)

Action: LTrim$ removes any non–printing characters (e.g. spaces, TABs) from the beginning of string.

Maximum

Syntax: Maximum(num_exp , num_expr)

Action: Maximum returns the larger of two numbers.

MBR

Syntax: MBR(obj_expr)

Action: Returns a rectangle object representing the minimum bounding rectangle (or MBR) which encompasses the specified obj_expr object. The MBR is also known as the bounds of an object.

A minimum bounding rectangle is defined as being the smallest rectangle which is large enough to encompass a particular object. In other words, the MBR of the United States extends east to the eastern tip of Maine, south to the southern tip of Hawaii, west to the western tip of Alaska, and north to the northern tip of Alaska.

The MBR of a point object has zero width and zero height.

Mapx Referenc 453

Page 468: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

Mid$

Syntax: Mid$(string, position, length)

string is a character expressionposition is an integer indicating a starting position in stringlength is an integer indicating the number of characters to extract

Action: Mid$ returns a string of a set length, starting at given position, in a specified string.

Examples: The following table shows how Mid$ acts with a position parameter of 5 and a length parameter of 4:

Note: The expression only returned two characters from “Denver”. That is because “Denver” is too short to have a four–character string starting at its fifth character.

Minimum

Syntax: Minimum(num_expr, num_expr)

Action: Minimum returns the smaller of two numbers.

Month

Syntax: Month(datefield)

Action: Returns the month of the date as a number, 1 through 12.

Examples: To select all received before August:• Month(received)<8

To select all received in August or September of 1990:• Month(received)=(8,9) and Year(received)=1990

ObjectLen

Syntax: ObjectLen(obj, unit)

Action: Returns the length of lines and polylines. Returns a value of 0 for other objects.

The unit parameter specifies the unit in which the length should be returned. The available units are:

String Mid$(String, 5, 4)

New York City York

Denver er

Singapore apor

Unit Name Unit Represented

“mi” miles

“km” kilometers

454 MapX Reference

Page 469: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

Examples: To calculate the length of an object in kilometers:• ObjectLen(obj,”km”)

To select all objects more than 10 miles long:• ObjectLen(obj, ”mi”)>10

Perimeter

Syntax: Perimeter(obj, unit)

Action: Returns the perimeter of the object for regions, ellipses, rectangles, and rounded rectangles. The unit parameter is a string specifying the unit to use. The available units are:

“in” inches

“ft” feet

“survey ft” survey feet

“yd” yards

“mm” millimeters

“cm” centimeters

“li” links

“rd” rods

“ch” chains

“m” meters

“nmi” nautical miles (1 nautical mile represents 1852 meters)

Unit Name Unit Represented

Unit Name Unit Represented

”mi” miles

”km” kilometers

”in” inches

”ft” feet

“li” links

“rd” rods

“ch” chains

”survey ft” survey feet

”yd” yards

”mm” millimeters

”cm” centimeters

Mapx Referenc 455

Page 470: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

Example: To select all objects with a perimeter greater than 35 kilometers long:• Perimeter(obj, ”km”)>35

Proper$

Syntax: Proper$(string)

Action: Returns a string that has the first letter of each word capitalized and all other letters lowercase.

Examples: The following table shows how the Proper$ function reformats a column in your table:

Right$

Syntax: Right$ (string_exp , num_expr)

Action: Returns the last num_expr characters of the string in string_expr.

Round

Syntax: Round(number1, number2)

Action: Returns the rounded number1. number2 specifies how to round it.

Examples: Consider the following expression:• Round(number1,number2)

The table below gives examples. The first column contains the function arguments (number1, number2) and the second column contains the rounded result.

”m” meters

”nmi” nautical miles (1 nautical mile represents 1852 meters)

Unit Name Unit Represented

String Proper$(String)

NEW YORK New York

new YorK New York

new york New York

New York New York

Arguments Rounded Number

14347,10000 10000

14347, 100 14300

14347, 10 14350

12.18353, .1 12.20000

456 MapX Reference

Page 471: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

To select all rows where the median age is 42, you might use the following expression:• Round(MED_AGE, 1)=42

Depending on your data, this expression may give better results than one that compares median age directly with a target value (MED_AGE=42). If a table contained median age data calculated to the nearest tenth, MapX would not select records where the median age is, for example, 41.7, 42.1, or 42.4. By rounding the median age value to a whole number, we can get those values.

RTrim$

Syntax: RTrim$(string)

Action: RTrim$ removes any white–space characters (e.g. spaces, and TABs) from the end of string.

Sgn

Syntax: Sgn(num_expr)

Action: Returns a value of -1 if num_expr is less than zero, a value of 0 if num_expr is equal to zero, or a value of 1 if num_expr is greater than zero.

Sin

Syntax: Sin(num_expr)

Action: The Sin function returns the sine of the value of a numeric expression, where that expression represents an angle expressed in radians.

Space$

Syntax: Space(num_expr)

Action: Returns a string num_expr characters long, consisting entirely of space characters.

If the num_expr value is less than or equal to zero, the Space$() function returns a null string.

Str$

Syntax: Str$(expr)

Action: Str$ converts a numerical expression into a string that represents it. When the numerical expression is negative the first character in the string with be a negative sign (–). The first character returned for a positive value is the first number. If the expression is an object, Str$() returns a string describing the type of object (e.g., “region”).

Sqr

Syntax: Sqr(num_expr)

12.18353, .001 12.18400

Arguments Rounded Number

Mapx Referenc 457

Page 472: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

Action: Returns the square root of the numeric expression specified by num_expr. Since the square root operation is undefined for negative real numbers, num_expr should represent a value greater than or equal to zero.

Taking the square root of a number is equivalent to raising that number to the power 0.5. Accordingly, the expression Sqr(n) is equivalent to the expression n ^ 0.5; the Sq() function, however, provides the fastest calculation of square roots.

Tan

Syntax: Tan(num_expr)

Action: Returns the tangent of the numeric num_expr value, which represents an angle in radian.

UCase$

Syntax: UCase$(string)

Action: Returns the upper case of the string.

Examples: The following table shows how UCase$ will act on the given input string:

Val

Syntax: Val(char_expr)

Action: The Val function extracts a numerical value from a character expression. It ignores any tabs, spaces, and line feeds at the start of a string and then tries to interpret the first sequence of numeric characters as a numerical value. It stops processing the string as soon as it finds a non–numeric character, excluding the minus (hyphen) sign and decimal point (period). When the first character after initial tabs, spaces, and line feeds is not a numeric character, Val returns a value of zero.

Examples: The following table illustrates how Val extracts a numerical value from an input string:

String UCase$(String)

NEW YORK NEW YORK

New yorK NEW YORK

new york NEW YORK

String Val(String)

12 thousand 12

52 – 62 Brunswick 52

Eighteen 0

Box 239 0

458 MapX Reference

Page 473: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

Weekday

Syntax: Weekday(datefield)

Action: Returns the day of the week from the data. The day is given as a number between one and seven. One is Sunday and Seven is Saturday.

Example: To select all rows where the weekday is Wednesday,Thursday or Friday:• Weekday(date)=(4,5,6)

Year

Syntax: Year(datefield)

Action: Returns the year of the date.

Example: To find all orders received in 1990 or 1991:• Year(date)=(1990,1991)

Mapx Referenc 459

Page 474: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Functions

460 MapX Reference

Page 475: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix D: Geoset Keys

Geosets are files (ending in .GST) that contain information about a set of layers, and can be loaded

at one time. A geoset is loaded by specifying one at design time (as a property), or using the

AddGeosetLayers method of the Layers object. A geoset file is an ASCII file containing strings.

These strings consist of keys and values. The keys correspond to properties in MapX – properties

for the main Map object, as well as for Layer objects.

Keys are hierarchical in nature, and are specified as quoted strings. Key values are also quoted

values – even number are quoted. The following is a sample showing some keys and values:

Sample Geoset!GEOSET

!VERSION 100

begin_metadata

"\GEOSET" = ""

"\GEOSET\NAME" = "SAMPLE GEOSET"

"\GEOSET\PROJECTION" = "3,62,7,-96,23,20,60,0,0"

"\GEOSET\CENTER" = "-54851.35483414936,1844196.997419479"

"\GEOSET\MBR" = ""

"\GEOSET\MBR\LOWERLEFT" = "-3093309.705881681,-450646.671927353"

"\GEOSET\MBR\UPPERRIGHT" = "2983606.996213382,4139040.666766311"

"\GEOSET\ZOOMLEVEL" = "4019.82"

"\GEOSET\AUTOLAYER" = "FALSE"

"\GEOSET\MAPUNIT" = "0"

"\GEOSET\ROTATION" = "0"

"\TABLE" = ""

"\TABLE\1" = ""

"\TABLE\1\FILE" = "usa_caps.tab"

"\TABLE\1\DESCRIPTION" = "US Capitals"

"\TABLE\1\ISVISIBLE" = "TRUE"

"\TABLE\1\AUTOLABEL" = "FALSE"

"\TABLE\1\DRAWLABELSAFTER" = "FALSE"

"\TABLE\1\SHOWLINEDIRECTION" = "FALSE"

Page 476: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix D: Geoset Keys

"\TABLE\1\SHOWNODES" = "FALSE"

"\TABLE\1\SHOWCENTROIDS" = "FALSE"

"\TABLE\1\EDITABLE" = "FALSE"

"\TABLE\1\SELECTABLE" = "TRUE"

"\TABLE\1\REGISTERINGEOODICT" = "TRUE"

"\TABLE\1\DISPLAY" = ""

"\TABLE\1\DISPLAY\BRUSH" = ""

"\TABLE\1\DISPLAY\BRUSH\Pattern" = "2"

"\TABLE\1\DISPLAY\BRUSH\Forecolor" = "16777215"

"\TABLE\1\DISPLAY\BRUSH\Backcolor" = "16777215"

"\TABLE\1\DISPLAY\BRUSH\Transparent" = "FALSE"

"\TABLE\1\DISPLAY\PEN" = ""

"\TABLE\1\DISPLAY\PEN\LineWidth" = "1"

"\TABLE\1\DISPLAY\PEN\LineStyle" = "1"

"\TABLE\1\DISPLAY\PEN\Pattern" = "2"

"\TABLE\1\DISPLAY\PEN\Color" = "0"

"\TABLE\1\DISPLAY\LINEPEN" = ""

"\TABLE\1\DISPLAY\LINEPEN\LineWidth" = "1"

"\TABLE\1\DISPLAY\LINEPEN\LineStyle" = "1"

"\TABLE\1\DISPLAY\LINEPEN\Pattern" = "2"

"\TABLE\1\DISPLAY\LINEPEN\Color" = "0"

"\TABLE\1\DISPLAY\FONT" = ""

"\TABLE\1\DISPLAY\FONT\Style" = "3"

"\TABLE\1\DISPLAY\FONT\ExtStyle" = "1"

"\TABLE\1\DISPLAY\FONT\Description" = "Arial"

"\TABLE\1\DISPLAY\FONT\Size" = "36"

"\TABLE\1\DISPLAY\FONT\Forecolor" = "0"

"\TABLE\1\DISPLAY\FONT\Backcolor" = "16777215"

"\TABLE\1\DISPLAY\FONT\Opaque" = "FALSE"

"\TABLE\1\DISPLAY\SYMBOL" = ""

"\TABLE\1\DISPLAY\SYMBOL\Type" = "1"

"\TABLE\1\DISPLAY\SYMBOL\Code" = "35"

"\TABLE\1\DISPLAY\SYMBOL\Color" = "255"

"\TABLE\1\DISPLAY\SYMBOL\Pointsize" = "14"

462 MapX Reference

Page 477: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix D: Geoset Keys

"\TABLE\1\DISPLAY\SYMBOL\Font" = ""

"\TABLE\1\DISPLAY\SYMBOL\Font\Style" = "0"

"\TABLE\1\DISPLAY\SYMBOL\Font\ExtStyle" = "0"

"\TABLE\1\DISPLAY\SYMBOL\Font\Description" = "Map Symbols"

"\TABLE\1\DISPLAY\SYMBOL\Font\Size" = "14"

"\TABLE\1\DISPLAY\SYMBOL\Font\Forecolor" = "255"

"\TABLE\1\DISPLAY\SYMBOL\Font\Backcolor" = "16777215"

"\TABLE\1\DISPLAY\SYMBOL\Font\Opaque" = "FALSE"

"\TABLE\1\DISPLAY\SYMBOL\Font\Rotation" = "0"

"\TABLE\1\LABEL" = ""

"\TABLE\1\LABEL\FONT" = ""

"\TABLE\1\LABEL\FONT\Style" = "0"

"\TABLE\1\LABEL\FONT\ExtStyle" = "0"

"\TABLE\1\LABEL\FONT\Description" = "Arial"

"\TABLE\1\LABEL\FONT\Size" = "9"

"\TABLE\1\LABEL\FONT\Forecolor" = "0"

"\TABLE\1\LABEL\FONT\Backcolor" = "16777215"

"\TABLE\1\LABEL\FONT\Opaque" = "FALSE"

"\TABLE\1\LABEL\DUPLICATE" = "TRUE"

"\TABLE\1\LABEL\PARALLEL" = "TRUE"

"\TABLE\1\LABEL\OVERLAP" = "FALSE"

"\TABLE\1\LABEL\PARTIALSEGMENTS" = "FALSE"

"\TABLE\1\LABEL\LINETYPE" = "2"

"\TABLE\1\LABEL\OFFSET" = "2"

"\TABLE\1\LABEL\POSITION" = "5"

end_metadata

The first eleven lines show keys beginning with the word 'GEOSET' – these are keys that set

properties for the entire map, or properties for the Map object. Notice that some keys, like

GEOSET\MBR are multi-level – there is a LOWERLEFT and an UPPERRIGHT.

Then next thirteen lines show keys setting properties for one layer – usa_caps. The keys begin

with 'TABLE'. The next word is any keyword to refer to the set of properties for a specific layer –

in this case they are the same word as the table file name. Then follow the hierarchical key values

for the specified layer.

Mapx Referenc 463

Page 478: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix D: Geoset Keys

Supported Keys

Below is the list of keys that are supported in a geoset file:

\GEOSET\

NAME 'Friendly' name of geoset

PROJECTION Projection clause

CENTER Number, Number – Long/Lat of the center of the map

\MBR\LOWERLEFT Number,Number - Long/Lat of lower left corner

\MBR\UPPERRIGHT Number,Number - Long/Lat of upper right corner

ZOOMLEVEL Number - Zoom level of the map

AUTOLAYER TRUE or FALSE - order layers automatically

MAPUNIT Number - corresponds to Map.MapUnit. Whenever the geoset is loaded into the map control, if there are no layers already loaded, the MapUnit will be set to the geoset's MapUnit. However,if there are layers already loaded, MapX will load the geoset and use the current map unit.

ROTATION Number - Rotation angle of the map. Corresponds to Map.Rotation

\TABLE\<number>\

FILE String - location of .TAB fil

DESCRIPTION String - Table description

ISVISIBLE TRUE or FALSE - whether layer is visible

AUTOLABEL TRUE or FALSE - whether layer is autolabeled

DRAWLABELSAFTER TRUE or FALSE - whether to draw labels after the layer is drawn

SHOWLINEDIRECTION TRUE or FALSE – Corresponds to Layer.ShowLineDirection

SHOWNODES TRUE or FALSE – Corresponds to Layer.ShowNodes

SHOWCENTROIDS TRUE or FALSE – Corresponds to Layer.ShowCentroids

EDITABLE TRUE or FALSE – Corresponds to Layer.Editable

SELECTABLE TRUE or FALSE – Corresponds to Layer.Selectable

REGISTERINGEODICT TRUE or FALSE – whether to register the geoset in the geodictionary

ZOOM\MIN Number - minimum zoom value to display layer (Layer.ZoomMin)

464 MapX Reference

Page 479: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix D: Geoset Keys

ZOOM\MAX Number - maximum zoom value to display layer (Layer.ZoomMax)

DISPLAY\BRUSH\

PATTERN Number - corresponds to Style.RegionPattern

FORECOLOR Number - corresponds to Style.RegionColor

BACKCOLOR Number - corresponds to Style.RegionBackColor

TRANSPARENT TRUE or FALSE - corresponds to Style.RegionTransparent

DISPLAY\PEN\

LINEWIDTH Number - corresponds to Style.RegionBorderWidth

LINESTYLE Number - corresponds to Style.RegionBorderStyle

COLOR Number - corresponds to Style.RegionBorderColor

DISPLAY\LINEPEN\

LINEWIDTH Number - corresponds to Style.LineWidth

LINESTYLE Number - corresponds to Style.LineStyle

COLOR Number - corresponds to Style.LineColor

DISPLAY\FONT\

STYLE Number - Bit Mask (BOLD 0x01, ITALIC 0x02, UNDER 0x04, STRIKEOUT 0x08, OUTLINE 0x10, SHADOW 0x20, INVERSE 0x40, BLINK 0x80)

EXTSTYLE Number - Bit Mask (HALO 0x01, ALLCAPS 0x02, DBLSPACE 0x04)

DESCRIPTION String - font name

SIZE Number - font size in points

FORECOLOR Number - Corresponds to Style.TextFontColor

BACKCOLOR Number - Corresponds to Style.TextFontBackColor

OPAQUE TRUE or FALSE - Corresponds to Style.TextFontOpaque

\TABLE\<number>\

Mapx Referenc 465

Page 480: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix D: Geoset Keys

TrueType Font Symbol Keys

Bitmap Symbol Keys

DISPLAY\SYMBOL\

TYPE Number – Corresponds to Style.SymbolType

CODE Number - Corresponds to Style.SymbolCharacter

COLOR Number - Corresponds to Style.SymbolFontColor

POINTSIZE Number - size of symbol in points

FONT This is the font of the symbol. This key is present if the symbol type is miSymbolTypeTrueTypeFont. It has the same sub-keys as DISPLAY\FONT

FONT\ROTATION The rotation angle of the font symbol. Corresponds to Style.SymbolFontRotation.

BITMAP\NAME String - Name of the bitmap symbol. Corresponds to Style.SymbolBitmapName.

BITMAP\OVERRIDECOLOR TRUE or FALSE – Whether to apply color to the symbol. Corresponds to Style.SymbolBitmapOverrideColor

BITMAP\TRANSPARENT TRUE or FALSE – Whether the bitmap is transparent. Corresponds to Style.SymbolBitmapTransparent.

LABEL\

ZOOM\MIN Number - minimum zoom value to label layer

ZOOM\MAX Number - maximum zoom value to label layer

FONT This is the label font. It has the same sub-keys as DISPLAY\FONT above

DUPLICATE TRUE or FALSE - permit duplicate labels

PARALLEL TRUE or FALSE - Corresponds to LabelProperties.Parallel

OVERLAP TRUE or FALSE - Corresponds to LabelProperties.Overlap

PARTIALSEGMENTS TRUE or FALSE – Corresponds to LabelProperties.PartialSegments

MAXLABELS Number - Corresponds to LabelProperties.LabelMax

LINETYPE Number - Corresponds to LabelProperties.LineType

OFFSET Number - Corresponds to LabelProperties.Offset

466 MapX Reference

Page 481: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix D: Geoset Keys

POSITION Number - Corresponds to LabelProperties.Position

LABEL\

Mapx Referenc 467

Page 482: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix D: Geoset Keys

468 MapX Reference

Page 483: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix E: OLE_COLOR Values

An OLE_COLOR value is a BGR (Blue, Green, Red) value. To determine the BGR value, specify blue, green, or red (each of which has a value from 0 - 255) in the following formula:

BGR value = (blue * 65536) + (green * 256) + red

Note: If you have used the MapBasic programming language, please note that MapBasic uses the following formula to calculate the RGB values:

RGB value = (red * 65536) + (green * 256) + blue

If you are working with RGB color values (e.g. values used with a MapBasic application), you will need to convert the colors to BGR before you can use those color values in MapX.

See Also

ColorConstants

Page 484: Reference Guide - Pitney Bowesreference1.mapinfo.com/common/docs/mapx-none-4.0-ref-pdf-none-en… · Reference Guide MapInfo Corporation ... Portions of the software are derived from

Appendix E: OLE_COLOR Values

470 MapX Reference