wkt.aspx Top
<%@ Page Language="VB" Debug="True" %>
<%@ Register TagPrefix="ttkGIS" Namespace="TatukGIS.IS" Assembly="TatukGIS.IS" %>
<script runat="server">
Dim GisUtils As API.XGIS_Utils
Dim layerObj As API.XGIS_LayerVector
dim type1 as string = "POINT (30 30)"
dim type2 as string = "MULTIPOINT (4 4, 5 5, 6 6 ,7 7)"
dim type3 as string = "LINESTRING (3 3, 10 10)"
dim type4 as string = "MULTILINESTRING ((1 1, 3 3, 4 4, 6 6),(2 4, 5 7, 8 10, 11 13))"
dim type5 as string = "POLYGON( ( 5 5, 25 5, 25 25, 5 25, 5 5), ( 10 10, 10 20, 20 20, 20 10, 10 10))"
Sub GIS_SetMaxExtent()
dim ex as New API.XGIS_Extent
'set max extent; GIS.API.RestrictedDrag has to be set on False
ex.XMin = -6
ex.YMin = -1
ex.XMax = 36
ex.YMax = 31
GIS.API.VisibleExtent = ex
End Sub
Sub GIS_FullExtent_Click(sender As Object, e As ImageClickEventArgs)
GIS_SetMaxExtent()
End Sub
Sub GIS_ZoomIn_Click(sender As Object, e As ImageClickEventArgs)
GIS.ZoomIn()
End Sub
Sub GIS_ZoomOut_Click(sender As Object, e As ImageClickEventArgs)
GIS.ZoomOut()
End Sub
Sub GIS_Smaller_Click(sender As Object, e As ImageClickEventArgs)
GIS.Width = Unit.Pixel( GIS.Width.Value - 54 )
GIS.Height = Unit.Pixel( GIS.Height.Value - 40 )
End Sub
Sub GIS_Larger_Click(sender As Object, e As ImageClickEventArgs)
GIS.Width = Unit.Pixel( GIS.Width.Value + 54 )
GIS.Height = Unit.Pixel( GIS.Height.Value + 40 )
End Sub
Sub GIS_Load(sender As Object, e As EventArgs)
GisUtils = New API.XGIS_Utils
layerObj = New API.XGIS_LayerVector
layerObj.Name = "output"
layerObj.Params.Area.Color = RGB(255, 0, 0)
GIS.API.Add(layerObj)
if not Page.IsPostBack then
lbl_Info.Text = type5
session("listType") = 5
end if
GIS.API.RestrictedDrag = False
End Sub
Sub GIS_BeforePaint(sender As Object, e As PaintEventArgs)
Dim shp As API.XGIS_Shape
If layerObj Is Nothing Then Exit Sub
'change text with WKT string if new object type is set
if session("listType") <> list_ShapeType.SelectedItem.Value then
Select Case list_ShapeType.SelectedItem.Value
Case 1
lbl_Info.Text = type1
Case 2
lbl_Info.Text = type2
Case 3
lbl_Info.Text = type3
Case 4
lbl_Info.Text = type4
Case 5
lbl_Info.Text = type5
End Select
session("listType") = list_ShapeType.SelectedItem.Value
end if
'try to build shape from string written in lbl_Info.Text
try
shp = GisUtils.GisCreateShapeFromWKT(lbl_Info.Text)
catch
shp = Nothing
end try
If Not shp Is Nothing Then
layerObj.AddShape(shp)
shp = Nothing
lbl_Info.BackColor = System.Drawing.Color.White
session("error") = False
Else
lbl_Info.BackColor = System.Drawing.Color.Red
session("error") = True
End If
'set proper extent
If not Page.IsPostBack then
GIS_SetMaxExtent()
Else
GIS.API.VisibleExtent = session("ex")
End If
End Sub
Sub GIS_Paint(sender As Object, e As PaintEventArgs)
GIS.Draw()
'remember extention if new shape was correct
if session("error") = False then
session("ex") = GIS.API.VisibleExtent
end if
End Sub
</script>
<html>
<head>
<title>TatukGIS IS Sample - WKT</title>
<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<a name="top">
<h1>WKT
</h1>
<h2 class="comment"><a href="../../samplesAPI.htm">TatukGIS Internet Server Samples</a>
</h2>
<form runat="server">
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td>
<asp:ImageButton id="GIS_FullExtent" onclick="GIS_FullExtent_Click" runat="server" ImageUrl="/TatukGIS_IS8/img/fullextent.gif"></asp:ImageButton>
<asp:ImageButton id="GIS_ZoomIn" onclick="GIS_ZoomIn_Click" runat="server" ImageUrl="/TatukGIS_IS8/img/zoomin.gif"></asp:ImageButton>
<asp:ImageButton id="GIS_ZoomOut" onclick="GIS_ZoomOut_Click" runat="server" ImageUrl="/TatukGIS_IS8/img/zoomout.gif"></asp:ImageButton>
</td>
<td align="right">
<asp:ImageButton id="GIS_Smaller" onclick="GIS_Smaller_Click" runat="server" ImageUrl="/TatukGIS_IS8/img/smaller.gif"></asp:ImageButton>
<asp:ImageButton id="GIS_Larger" onclick="GIS_Larger_Click" runat="server" ImageUrl="/TatukGIS_IS8/img/larger.gif"></asp:ImageButton>
</td>
</tr>
<tr>
<td colspan="2">
<p>
<ttkGIS:XGIS_VIEWERIS id="GIS" runat="server" Height="280px" Width="360px" OnLoad="GIS_Load" BorderColor="CornflowerBlue" BorderWidth="1px" OnPaint="GIS_Paint" OnBeforePaint="GIS_BeforePaint"></ttkGIS:XGIS_VIEWERIS>
</p>
</td>
</tr>
<tr>
<td colspan="2">
<p>
</p>
</td>
</tr>
</tbody>
</table>
<p>
<asp:Label id="Label1" runat="server" cssclass="bold" forecolor="Gray">Use list to
change WKT type: </asp:Label> <asp:DropDownList id="list_ShapeType" runat="server" AutoPostBack="True">
<asp:ListItem Value="1">POINT</asp:ListItem>
<asp:ListItem Value="2">MULTIPOINT</asp:ListItem>
<asp:ListItem Value="3">LINESTRING</asp:ListItem>
<asp:ListItem Value="4">MULTILINESTRING</asp:ListItem>
<asp:ListItem Value="5" Selected="True">POLYGON</asp:ListItem>
</asp:DropDownList>
</p>
<p>
<asp:Label id="Label2" runat="server" cssclass="bold" forecolor="Gray">Edit WKT string</asp:Label>:
<br />
<asp:TextBox id="lbl_Info" runat="server" Width="476px"></asp:TextBox>
<asp:Button id="Btn_Change" runat="server" Text="Change"></asp:Button>
</p>
</form>
</a>
</body>
</html>