C# Class WindowHelper.InteropHelper

Mostrar archivo Open project: PeterHorsbollMoller/mbWindowHelper

Public Methods

Method Description
AddTableToMap ( int windowId, string table ) : void

Adds a table to a existing map

CloseMITable ( string tableName ) : void

Closes a table open in MapInfo

CreateDummyTableWithID ( string tableName ) : void

Create a dummy table with only an ID column

CreateLineInCosmeticLayer ( Int32 windowID, Double startX, Double startY, Double endX, Double endY, String csys ) : void

Inserting points into cosmetic layer

CreatePointInCosmeticLayer ( Int32 windowID, Double pointX, Double pointY, String csys ) : void

Inserting points into cosmetic layer

DisableHandler ( string handlerName ) : void
Do ( string statement ) : void

Sends a statement to MapInfo to be executed

EnableHandler ( string handlerName ) : void
EndOfMITable ( string tableName ) : bool

Checks whether the cursor is at end of table

Eval ( string statement ) : string

Sends a statement to MapInfo to be evaluated

FetchFirstFromMITable ( string tableName ) : void

Fetching first record from a given table

FetchLastFromMITable ( string tableName ) : void

Fetching last record from a given table

FetchNextFromMITable ( string tableName ) : void

Fetching next record from a given table

FetchPrevFromMITable ( string tableName ) : void

Fetching previous record from a given table

GetAppVersion ( ) : string

Gets the MapInfo Professional version number

GetCoordSysClauseFromEPSG ( String EPSG ) : string

Gets the coordinatsystem from an ESPG code

GetDeformattedString ( string numericString ) : string
GetFormattedString ( string numericString ) : string

Given a string representation of a number, in invariant formatting (always using the period as the decimal separator), return a string formatted according to the user's current system settings.

The resulting number string is appropriate for displaying numbers in the user interface, but not appropriate for constructing MapBasic statements. When you construct a MapBasic statement string (to be executed through a call to the Do method), any numeric literals in the string must use period as the decimal separator, even if the user's system's regional settings use some other character as the decimal separator.

GetFrontWindow ( ) : int

Get front window (child window) from the running instance of MapInfo Professional

GetMapWindowId ( ) : int

Get the ID of the front window. Displays a message and returns 0 if there is no window open, or the front window is not a mapper

GetMapperCenterX ( int windowId ) : string

Gets mapper window center X value

GetMapperCenterY ( int windowId ) : string

Gets mapper window center Y value

GetMapperCoordSys ( int windowId ) : string

Get a string representing the coordinate system of the map window

GetMapperDistanceUnit ( int windowId ) : string

Get a string representing the distance unit in use in a specific map window

GetMapperZoom ( int windowId ) : string

Gets mapper window zoom value

GetNumberOfOpenTables ( ) : int

Get a number representing the number of records in a given table

GetOpenTablesList ( ) : string[]

Get a list of open tables

GetSessionCoordSys ( ) : string

Get a string representing the CoordSys clause of the coordinate system that is currently in effect.

GetSessionDistanceUnit ( ) : string

Gets a string representing MapInfo's current distance units, such as mi or km. Defaults to "mi" but can be reset through the Set Distance Units statement.

GetSessionPaperUnit ( ) : string

Gets a string representing MapInfo's current paper units, such as mi or km. Defaults to "in" but can be reset through the Set Distance Units statement.

GetTableCoordsys ( int tableId ) : string

Get a string representing the coordsys of a given table

GetTableCoordsys ( string tableName ) : string

Get a string representing the coordsys of a given table

GetTableNumRows ( int tableId ) : Int32

Get a number representing the number of records in a given table

GetTableNumRows ( string tableName ) : Int32

Get a number representing the number of records in a given table

GetWindowCloneStatement ( int windowId ) : string
GetWindowHeight ( int windowId ) : Double
GetWindowName ( int windowId ) : string

Returns window name for given window id.

GetWindowSystemMenuClose ( int windowId ) : bool
GetWindowType ( int windowId ) : int

Returns window type for given window id.

GetWindowWidth ( int windowId ) : Double
GetWindowWorkspaceStatement ( int windowId ) : string
InsertLineIntoTable ( string table, Double startX, Double startY, Double endX, Double endY, String csys ) : void

Inserting lines into a table

InsertLineIntoTableWithID ( string table, int id, Double startX, Double startY, Double endX, Double endY, String csys ) : void

Inserting lines into a table

InsertPointIntoTable ( string table, Double pointX, Double pointY, String csys ) : void

Inserting points into a table

MakeTableMappable ( string tableName, string csys ) : void

Create a dummy table with only an ID column

PrintMessage ( string sText ) : void

Prints a message to the MapInfo Message window

ReadMBRFromMITableCurrentRecord ( string tableName ) : MBR

Reading a MBR from the object for the current record in a table

ReadValueFromMITableCurrentRecord ( string tableName, string columnName ) : string

Reading a value from a column for the current record in a table

RunSQLStatement ( string sCmd, string sIntoTable ) : Int32
SetCoordSysUsingTable ( string tableName ) : void

Sets the current coordinatsystem using a table

SetCoordSysUsingWindow ( Int32 windowID ) : void

Sets the current coordinatsystem using a mapper

SetSessionCoordSys ( string csys ) : void

Set the current coordinate system. Has the same effect as typing a Set CoordSys statement into the MapBasic window.

SetSessionDistanceUnit ( string unit ) : void

Sets MapInfo's current distance unit, such as mi or km. Has the same effect as typing a Set Distance Units statement into the MapBasic window.

SetSessionPaperUnit ( string unit ) : void

Sets MapInfo's current paper unit, such as in or cm. Has the same effect as typing a Set Paper Units statement into the MapBasic window.

SetView ( int windowId, double centerX, double centerY, double mapperZoom, string unit, string csys ) : void
SetView ( int windowId, string mapperZoom, string unit ) : void

Sets the current view of mapper window represented by windowId

SetView ( int windowId, string centerX, string centerY, string csys ) : void

Sets the current view of mapper window represented by windowId

SetView ( int windowId, string centerX, string centerY, string mapperZoom, string unit, string csys ) : void

Sets the current view of mapper window represented by windowId

SetViewMBR ( int windowId, MBR mipMBR, string unit, string csys ) : void

Sets the current view of mapper window represented by windowId using a MapInfo MBR

SetViewTable ( int windowId, string table ) : void

Sets the current view of mapper window represented by windowId to match a table

Private Methods

Method Description
GetMapperInfo ( int windowId, int infoType ) : string

Gets the view information from a mapper window in MapInfo Professional application

MapBasic's MapperInfo function can return numeric information such as Zoom width. However, MapInfoApplication.Eval returns results as strings, so if you request numeric information such as MAPPER_INFO_ZOOM, Eval will return a string such as "1234.5" (with a period as the decimal separator, regardless of the user's regional settings). Instead of parsing such String results into Double values, we will return the String results. The string representation of numeric values is ideal for this application, because the string formatting returned by the Eval method (i.e. always using the period as the decimal separator) is appropriate for use in the Set Map statement we will be constructing later on.

GetTableInfo ( int tableId, int infoType ) : string

Gets the view information from a mapper window in MapInfo Professional application

MapBasic's TableInfo function can return numeric information such as Minimun X coordinate. However, MapInfoApplication.Eval returns results as strings, so if you request numeric information such as TAB_INFO_MINX, Eval will return a string such as "123456.789" (with a period as the decimal separator, regardless of the user's regional settings). Instead of parsing such String results into Double values, we will return the String results.

GetTableInfo ( string tableName, int infoType ) : string

Method Details

AddTableToMap() public static method

Adds a table to a existing map
public static AddTableToMap ( int windowId, string table ) : void
windowId int Window identification number of mapper window
table string Title of table to add
return void

CloseMITable() public static method

Closes a table open in MapInfo
public static CloseMITable ( string tableName ) : void
tableName string identification name of table
return void

CreateDummyTableWithID() public static method

Create a dummy table with only an ID column
public static CreateDummyTableWithID ( string tableName ) : void
tableName string identification name of table
return void

CreateLineInCosmeticLayer() public static method

Inserting points into cosmetic layer
public static CreateLineInCosmeticLayer ( Int32 windowID, Double startX, Double startY, Double endX, Double endY, String csys ) : void
windowID System.Int32
startX Double
startY Double
endX Double
endY Double
csys String
return void

CreatePointInCosmeticLayer() public static method

Inserting points into cosmetic layer
public static CreatePointInCosmeticLayer ( Int32 windowID, Double pointX, Double pointY, String csys ) : void
windowID System.Int32
pointX Double
pointY Double
csys String
return void

DisableHandler() public static method

public static DisableHandler ( string handlerName ) : void
handlerName string
return void

Do() public static method

Sends a statement to MapInfo to be executed
public static Do ( string statement ) : void
statement string statement to send to MapInfo
return void

EnableHandler() public static method

public static EnableHandler ( string handlerName ) : void
handlerName string
return void

EndOfMITable() public static method

Checks whether the cursor is at end of table
public static EndOfMITable ( string tableName ) : bool
tableName string identification name of table
return bool

Eval() public static method

Sends a statement to MapInfo to be evaluated
public static Eval ( string statement ) : string
statement string statement to send to MapInfo
return string

FetchFirstFromMITable() public static method

Fetching first record from a given table
public static FetchFirstFromMITable ( string tableName ) : void
tableName string identification name of table
return void

FetchLastFromMITable() public static method

Fetching last record from a given table
public static FetchLastFromMITable ( string tableName ) : void
tableName string identification name of table
return void

FetchNextFromMITable() public static method

Fetching next record from a given table
public static FetchNextFromMITable ( string tableName ) : void
tableName string identification name of table
return void

FetchPrevFromMITable() public static method

Fetching previous record from a given table
public static FetchPrevFromMITable ( string tableName ) : void
tableName string identification name of table
return void

GetAppVersion() public static method

Gets the MapInfo Professional version number
public static GetAppVersion ( ) : string
return string

GetCoordSysClauseFromEPSG() public static method

Gets the coordinatsystem from an ESPG code
public static GetCoordSysClauseFromEPSG ( String EPSG ) : string
EPSG String
return string

GetDeformattedString() public static method

public static GetDeformattedString ( string numericString ) : string
numericString string
return string

GetFormattedString() public static method

Given a string representation of a number, in invariant formatting (always using the period as the decimal separator), return a string formatted according to the user's current system settings.
The resulting number string is appropriate for displaying numbers in the user interface, but not appropriate for constructing MapBasic statements. When you construct a MapBasic statement string (to be executed through a call to the Do method), any numeric literals in the string must use period as the decimal separator, even if the user's system's regional settings use some other character as the decimal separator.
public static GetFormattedString ( string numericString ) : string
numericString string A number string with period (.) as the decimal separator, if any
return string

GetFrontWindow() public static method

Get front window (child window) from the running instance of MapInfo Professional
public static GetFrontWindow ( ) : int
return int

GetMapWindowId() public static method

Get the ID of the front window. Displays a message and returns 0 if there is no window open, or the front window is not a mapper
public static GetMapWindowId ( ) : int
return int

GetMapperCenterX() public static method

Gets mapper window center X value
public static GetMapperCenterX ( int windowId ) : string
windowId int window identification number of mapper window
return string

GetMapperCenterY() public static method

Gets mapper window center Y value
public static GetMapperCenterY ( int windowId ) : string
windowId int window identification number of mapper window
return string

GetMapperCoordSys() public static method

Get a string representing the coordinate system of the map window
public static GetMapperCoordSys ( int windowId ) : string
windowId int identification number of mapper window
return string

GetMapperDistanceUnit() public static method

Get a string representing the distance unit in use in a specific map window
public static GetMapperDistanceUnit ( int windowId ) : string
windowId int identification number of mapper window
return string

GetMapperZoom() public static method

Gets mapper window zoom value
public static GetMapperZoom ( int windowId ) : string
windowId int identification number of mapper window
return string

GetNumberOfOpenTables() public static method

Get a number representing the number of records in a given table
public static GetNumberOfOpenTables ( ) : int
return int

GetOpenTablesList() public static method

Get a list of open tables
public static GetOpenTablesList ( ) : string[]
return string[]

GetSessionCoordSys() public static method

Get a string representing the CoordSys clause of the coordinate system that is currently in effect.
public static GetSessionCoordSys ( ) : string
return string

GetSessionDistanceUnit() public static method

Gets a string representing MapInfo's current distance units, such as mi or km. Defaults to "mi" but can be reset through the Set Distance Units statement.
public static GetSessionDistanceUnit ( ) : string
return string

GetSessionPaperUnit() public static method

Gets a string representing MapInfo's current paper units, such as mi or km. Defaults to "in" but can be reset through the Set Distance Units statement.
public static GetSessionPaperUnit ( ) : string
return string

GetTableCoordsys() public static method

Get a string representing the coordsys of a given table
public static GetTableCoordsys ( int tableId ) : string
tableId int identification number of table
return string

GetTableCoordsys() public static method

Get a string representing the coordsys of a given table
public static GetTableCoordsys ( string tableName ) : string
tableName string identification name of table
return string

GetTableNumRows() public static method

Get a number representing the number of records in a given table
public static GetTableNumRows ( int tableId ) : Int32
tableId int identification number of table
return System.Int32

GetTableNumRows() public static method

Get a number representing the number of records in a given table
public static GetTableNumRows ( string tableName ) : Int32
tableName string identification name of table
return System.Int32

GetWindowCloneStatement() public static method

public static GetWindowCloneStatement ( int windowId ) : string
windowId int
return string

GetWindowHeight() public static method

public static GetWindowHeight ( int windowId ) : Double
windowId int
return Double

GetWindowName() public static method

Returns window name for given window id.
public static GetWindowName ( int windowId ) : string
windowId int
return string

GetWindowSystemMenuClose() public static method

public static GetWindowSystemMenuClose ( int windowId ) : bool
windowId int
return bool

GetWindowType() public static method

Returns window type for given window id.
public static GetWindowType ( int windowId ) : int
windowId int
return int

GetWindowWidth() public static method

public static GetWindowWidth ( int windowId ) : Double
windowId int
return Double

GetWindowWorkspaceStatement() public static method

public static GetWindowWorkspaceStatement ( int windowId ) : string
windowId int
return string

InsertLineIntoTable() public static method

Inserting lines into a table
public static InsertLineIntoTable ( string table, Double startX, Double startY, Double endX, Double endY, String csys ) : void
table string
startX Double
startY Double
endX Double
endY Double
csys String
return void

InsertLineIntoTableWithID() public static method

Inserting lines into a table
public static InsertLineIntoTableWithID ( string table, int id, Double startX, Double startY, Double endX, Double endY, String csys ) : void
table string
id int
startX Double
startY Double
endX Double
endY Double
csys String
return void

InsertPointIntoTable() public static method

Inserting points into a table
public static InsertPointIntoTable ( string table, Double pointX, Double pointY, String csys ) : void
table string
pointX Double
pointY Double
csys String
return void

MakeTableMappable() public static method

Create a dummy table with only an ID column
public static MakeTableMappable ( string tableName, string csys ) : void
tableName string identification name of table
csys string
return void

PrintMessage() public static method

Prints a message to the MapInfo Message window
public static PrintMessage ( string sText ) : void
sText string
return void

ReadMBRFromMITableCurrentRecord() public static method

Reading a MBR from the object for the current record in a table
public static ReadMBRFromMITableCurrentRecord ( string tableName ) : MBR
tableName string identification name of table
return WindowHelper.Geometry.MBR

ReadValueFromMITableCurrentRecord() public static method

Reading a value from a column for the current record in a table
public static ReadValueFromMITableCurrentRecord ( string tableName, string columnName ) : string
tableName string identification name of table
columnName string identification name of column
return string

RunSQLStatement() public static method

public static RunSQLStatement ( string sCmd, string sIntoTable ) : Int32
sCmd string
sIntoTable string
return System.Int32

SetCoordSysUsingTable() public static method

Sets the current coordinatsystem using a table
public static SetCoordSysUsingTable ( string tableName ) : void
tableName string identification name of table
return void

SetCoordSysUsingWindow() public static method

Sets the current coordinatsystem using a mapper
public static SetCoordSysUsingWindow ( Int32 windowID ) : void
windowID System.Int32 identification ID of a Window
return void

SetSessionCoordSys() public static method

Set the current coordinate system. Has the same effect as typing a Set CoordSys statement into the MapBasic window.
public static SetSessionCoordSys ( string csys ) : void
csys string string such as "CoordSys Earth"
return void

SetSessionDistanceUnit() public static method

Sets MapInfo's current distance unit, such as mi or km. Has the same effect as typing a Set Distance Units statement into the MapBasic window.
public static SetSessionDistanceUnit ( string unit ) : void
unit string a distance unit string, such as mi or km
return void

SetSessionPaperUnit() public static method

Sets MapInfo's current paper unit, such as in or cm. Has the same effect as typing a Set Paper Units statement into the MapBasic window.
public static SetSessionPaperUnit ( string unit ) : void
unit string a distance unit string, such as in or cm
return void

SetView() public static method

public static SetView ( int windowId, double centerX, double centerY, double mapperZoom, string unit, string csys ) : void
windowId int
centerX double
centerY double
mapperZoom double
unit string
csys string
return void

SetView() public static method

Sets the current view of mapper window represented by windowId
public static SetView ( int windowId, string mapperZoom, string unit ) : void
windowId int Window identification number of mapper window
mapperZoom string New zoom of the mapper window
unit string Distance unit string that applies to mapperZoom, such as mi or km
return void

SetView() public static method

Sets the current view of mapper window represented by windowId
public static SetView ( int windowId, string centerX, string centerY, string csys ) : void
windowId int Window identification number of mapper window
centerX string New center X of the mapper window
centerY string New center Y of the mapper window
csys string CoordSys string that specifies the coordinate system used by the X/Y arguments
return void

SetView() public static method

Sets the current view of mapper window represented by windowId
public static SetView ( int windowId, string centerX, string centerY, string mapperZoom, string unit, string csys ) : void
windowId int Window identification number of mapper window
centerX string New center X of the mapper window
centerY string New center Y of the mapper window
mapperZoom string New zoom of the mapper window
unit string Distance unit string that applies to mapperZoom, such as mi or km
csys string CoordSys string that specifies the coordinate system used by the X/Y arguments
return void

SetViewMBR() public static method

Sets the current view of mapper window represented by windowId using a MapInfo MBR
public static SetViewMBR ( int windowId, MBR mipMBR, string unit, string csys ) : void
windowId int Window identification number of mapper window
mipMBR WindowHelper.Geometry.MBR MBR to fit Map to
unit string
csys string CoordSys string that specifies the coordinate system used by the mipMBR arguments
return void

SetViewTable() public static method

Sets the current view of mapper window represented by windowId to match a table
public static SetViewTable ( int windowId, string table ) : void
windowId int Window identification number of mapper window
table string Table to zoom to
return void