Ivisibilityconstraint, Code example: animation layer – Pitney Bowes MapXtreme User Manual

Page 245

Advertising
background image

Chapter 12: Adding Mapping Capability to Your Applications

Layers

MapXtreme v7.1

252

Developer Guide

IVisibilityConstraint

The IVisibilityConstraint is an interface which determines whether a particular object is visible or not.
This interface is implemented by a wide number of types, including all Layer types, LabelModifiers,
FeatureStyleModifiers, and Themes.

Code Example: Animation Layer

The following VB sample shows how to set the animation of a layer.

Private Sub btnInitializeObjects_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnInitializeObjects.Click
Dim Cat As Catalog = MapInfo.Engine.Session.Current.Catalog

'Create Temp layer
Dim tblInfoTemp As New TableInfoMemTable("Animation")
Dim tblTemp As Table = Cat.GetTable("Animation")
If IsNothing(tblTemp) = False Then 'Table exists close it
Cat.CloseTable("Animation")
End If
tblInfoTemp.Columns.Add(ColumnFactory.CreateFeatureGeometryColumn(Map_
Control1.Map.GetDisplayCoordSys()))
tblInfoTemp.Columns.Add(ColumnFactory.CreateStyleColumn())
tblInfoTemp.Columns.Add(ColumnFactory.CreateStringColumn("Name", 40))
tblInfoTemp.Columns.Add(ColumnFactory.CreateStringColumn("Dept", 15))
tblInfoTemp.Columns.Add(ColumnFactory.CreateIntColumn("Level"))

tblTemp = Cat.CreateTable(tblInfoTemp)

Dim lyr As New FeatureLayer(tblTemp)
MapControl1.Map.Layers.Add(lyr)

'Create Points
Dim pt As FeatureGeometry = New Point(lyr.CoordSys, New DPoint(-76, 42))
Dim cs As New CompositeStyle(New SimpleVectorPointStyle(37, _

System.Drawing.Color.Red, 10))

Dim ftr As New Feature(tblTemp.TableInfo.Columns)
ftr.Geometry = pt
ftr.Style = cs
ftr.Item("Name") = "Kelly"
ftr.Item("Dept") = "Sales"
ftr.Item("Level") = 3
tblTemp.InsertFeature(ftr)

Dim pt2 As FeatureGeometry = New Point(lyr.CoordSys, New DPoint(-119, 34))
Dim cs2 As New CompositeStyle(New SimpleVectorPointStyle(44, _

System.Drawing.Color.Purple, 10))

Dim ftr2 As New Feature(tblTemp.TableInfo.Columns)
ftr2.Geometry = pt2
ftr2.Style = cs2
ftr2.Item("Name") = "Greg"
ftr2.Item("Dept") = "Marketing"

Advertising