Map Rotation

TatukGIS Internet Server Samples


Enter rotation angle:

Source code

This TatukGIS Internet Server sample shows how to provide the on-line user the ability to control the angle of rotation in which the map layers are presented.


rotation.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

    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

        Dim ll As API.XGIS_LayerSHP
    
       'add some layers
        ll = New API.XGIS_LayerSHP
        ll.Path = GisUtils.GisSamplesDataDir + "states2.shp"
        ll.Name = "states"
        GIS.API.Add(ll)
    
        ll = New API.XGIS_LayerSHP
        ll.Path = GisUtils.GisSamplesDataDir + "rivers.shp"
        ll.Name = "rivers"
        GIS.API.Add(ll)

       'Set a rotation point in central point of extent
        GIS.API.RotationPoint = GisUtils.GisCenterPoint(GIS.API.Extent)
        GIS.ImageType = XgisImageType.PNG24
    
       'set rotation angle
        dim aValue as integer
        if isNumeric(AngleBox.Text) then
            aValue = cint(AngleBox.Text)
            if Not (aValue >= 0 and aValue <= 360)
                aValue = 0
                AngleBox.Text = "0"
            end if
        else
            avalue = 0
            AngleBox.Text = "0"
        end if
        GIS.API.RotationAngle = aValue * (Math.PI / 180)
    
        GIS.FullExtent()
        GIS.Zoom = GIS.Zoom * 2
    
    End Sub
    
    Sub AngleBox_TextChanged(sender As Object, e As EventArgs)
        if Not isNumeric(AngleBox.Text) then
            AngleBox.Text = "0"
        end if
    End Sub

</script>
<html>
<head>
    <title>TatukGIS IS Sample</title>
    <link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body>
    <a name="top">
    <h1>Map Rotation
    </h1>
    <h2 class="comment"><a href="../../samplesAPI.htm">TatukGIS Internet Server Samples</a>
    </h2>
    <form runat="server">
        <p>
            <br />
        </p>
        <table style="WIDTH: 237px; HEIGHT: 204px" 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"></ttkGIS:XGIS_VIEWERIS>
                        </p>
                    </td>
                </tr>
            </tbody>
        </table>
        <asp:Label id="Label1" runat="server" cssclass="bold">Enter rotation angle: </asp:Label>
        <asp:TextBox id="AngleBox" runat="server" Width="147px" OnTextChanged="AngleBox_TextChanged">0</asp:TextBox>
        <asp:Button id="AngleButton" runat="server" Text="Rotate"></asp:Button>
</body>
</html>