topology.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 topologyObj As API.XGIS_Topology
Dim layerObj As API.XGIS_LayerVector
Dim ll As API.XGIS_LayerVector
Dim shpA As API.XGIS_Shape
Dim shpB As API.XGIS_Shape
Dim combType as API.XGIS_TopologyCombineType
Dim dir as boolean
Sub Page_Load(sender As Object, e As EventArgs)
if Not Page.IsPostback then
session("comb") = 0
end if
End Sub
Sub GIS_FullExtent_Click(sender As Object, e As ImageClickEventArgs)
GIS.FullExtent
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
GIS.Open( GisUtils.GisSamplesDataDir + "topology.shp" )
ll = GIS.API.Items.Item(0)
If ll Is Nothing Then
Exit Sub
End If
ll.Params.Area.OutlineColor = RGB(180, 180, 180)
ll.Params.Area.Color = RGB(220, 220, 220)
'set output layer
layerObj = New API.XGIS_LayerVector()
layerObj.Name = "output"
GIS.API.Add(layerObj)
GIS.FullExtent()
GIS.ImageType = XgisImageType.PNG24
End Sub
Sub GIS_Paint(sender As Object, e As PaintEventArgs)
Dim comb as integer
Dim tmp As API.IXGIS_Shape
'Draw shapes with choosen topology operation
comb = session("comb")
topologyObj = New API.XGIS_Topology()
'set Topology parameters and result shape color
Select Case comb
Case 1
combType = API.XGIS_TopologyCombineType.XgisTopologyCombineTypeUnion
dir = True
layerObj.Params.Area.Color = RGB(192, 0, 0)
Case 2
layerObj.Params.Area.Color = RGB(128, 128, 0)
dir = True
combType = API.XGIS_TopologyCombineType.XgisTopologyCombineTypeIntersection
Case 3
layerObj.Params.Area.Color = RGB(0, 128, 128)
dir = True
combType = API.XGIS_TopologyCombineType.XgisTopologyCombineTypeDifference
Case 4
layerObj.Params.Area.Color = RGB(0, 0, 128)
dir = False
combType = API.XGIS_TopologyCombineType.XgisTopologyCombineTypeDifference
Case 5
layerObj.Params.Area.Color = RGB(128, 0, 128)
dir = True
combType = API.XGIS_TopologyCombineType.XgisTopologyCombineTypeSymmetricalDifference
End select
'set shapes A and B
If dir = TRUE then
shpA = ll.GetShape(1).MakeEditable
If shpA Is Nothing Then
Exit Sub
End If
shpB = ll.GetShape(2).MakeEditable
If shpB Is Nothing Then
Exit Sub
End If
shpA.Params.Labels.Value = "Shape A"
shpB.Params.Labels.Value = "Shape B"
else
shpB = ll.GetShape(1).MakeEditable
If shpB Is Nothing Then
Exit Sub
End If
shpA = ll.GetShape(2).MakeEditable
If shpA Is Nothing Then
Exit Sub
End If
shpA.Params.Labels.Value = "Shape B"
shpB.Params.Labels.Value = "Shape A"
end if
'set labels
shpA.Params.Labels.Color = System.Convert.ToUInt32(RGB(255, 255, 255))
shpA.Params.Labels.FontColor = System.Convert.ToUInt32(RGB(80, 80, 80))
shpB.Params.Labels.Color = System.Convert.ToUInt32(RGB(255, 255, 255))
shpB.Params.Labels.FontColor = System.Convert.ToUInt32(RGB(80, 80, 80))
if comb >= 1 and comb <= 5 then
'Combine shapes
tmp = topologyObj.Combine(shpA, shpB, combType, False)
If Not tmp Is Nothing Then
layerObj.AddShape(tmp)
tmp = Nothing
End If
end if
GIS.Draw()
End Sub
Sub Button1_Click(sender As Object, e As EventArgs)
session("comb") = 1
End Sub
Sub Button2_Click(sender As Object, e As EventArgs)
session("comb") = 2
End Sub
Sub Button3_Click(sender As Object, e As EventArgs)
session("comb") = 3
End Sub
Sub Button4_Click(sender As Object, e As EventArgs)
session("comb") = 4
End Sub
Sub Button5_Click(sender As Object, e As EventArgs)
session("comb") = 5
End Sub
</script>
<html>
<head>
<title>TatukGIS IS Sample - Topology</title>
<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<a name="top">
<h1>Topology
</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>
<asp:RadioButtonList id="RadioButtonList1" runat="server" RepeatDirection="Horizontal"></asp:RadioButtonList>
</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" OnPaint="GIS_Paint" BorderWidth="1px" BorderColor="CornflowerBlue" OnLoad="GIS_Load" Width="360px" Height="280px"></ttkGIS:XGIS_VIEWERIS>
</p>
</td>
</tr>
<tr>
<td colspan="2">
<p>
</p>
</td>
</tr>
</tbody>
</table>
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="A + B" BackColor="#C00000" ForeColor="White" Font-Bold="True"></asp:Button>
<asp:Button id="Button2" onclick="Button2_Click" runat="server" Text="A * B" BackColor="Olive" ForeColor="White" Font-Bold="True"></asp:Button>
<asp:Button id="Button3" onclick="Button3_Click" runat="server" Text="A - B" BackColor="Teal" ForeColor="White" Font-Bold="True"></asp:Button>
<asp:Button id="Button4" onclick="Button4_Click" runat="server" Text="B - A" BackColor="Navy" ForeColor="White" Font-Bold="True"></asp:Button>
<asp:Button id="Button5" onclick="Button5_Click" runat="server" Text="A xor B" BackColor="Purple" ForeColor="White" Font-Bold="True"></asp:Button>
</form>
</a>
</body>
</html>