Quantcast
Channel: DotSpatial
Viewing all articles
Browse latest Browse all 3973

New Post: Developer Getting Started Guide frustration

$
0
0
I had tons of trouble with this too. The instructions are for a prior version I think. This is what I did to make the sample work:
  1. Add your DotSpatial libraries in the Project references.
  2. Add System.ComponetModel.Composition to your project references
  3. Create a project with one form and no controls on the form. NO CONTROLS. The app manger will create all of them for you. If you add a tab control, frames, maps, i think it will get confused. Below is my code behind the form
  4. Add Plugins folder, Tools folder, and Windows Extensions folder in the bin\Debug folder and copy the same from the main DotSpatial download.
'if you are using the AppManager then DO NOT add any controls. All you need is the Form and the AppManager.
Imports System.ComponentModel.Composition
Imports System.Linq
Imports DotSpatial.Data
Imports DotSpatial.Controls
Imports DotSpatial.Symbology
Imports System.Drawing.Drawing2D

Partial Public Class Form1
    Inherits Form
    <Export("Shell", GetType(ContainerControl))> _
    Private Shared Shell As ContainerControl
    Public Sub New()
        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        If DesignMode Then Return
        Shell = Me
        AppManager1.LoadExtensions()
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'basic loading of a raster
        Dim r As IRaster = Raster.Open("X:\Rasters\US\usterr\sta.adf")
        Dim mylayer As IMapRasterLayer = AppManager1.Map.Layers.Add(r)
        ControlRange(mylayer)
    End Sub

    Private Sub ControlRange(myLayer As IMapRasterLayer)
        'basic render
        'myLayer.Symbolizer.Scheme.Categories(0).Range = New Range(3200, 3450)
        'myLayer.Symbolizer.Scheme.Categories(0).ApplyMinMax(myLayer.Symbolizer.EditorSettings)
        'myLayer.Symbolizer.Scheme.Categories(1).Range = New Range(3440, 3700)
        'myLayer.Symbolizer.Scheme.Categories(1).ApplyMinMax(myLayer.Symbolizer.EditorSettings)
        'myLayer.Symbolizer.ShadedRelief.ElevationFactor = 1 'Shaded Relief
        'myLayer.Symbolizer.ShadedRelief.IsUsed = True 'Shaded Relief
        'myLayer.WriteBitmap()

        'Predefined Schemes
        'myLayer.Symbolizer.Scheme.ApplyScheme(ColorSchemeType.Glaciers, myLayer.DataSet)
        'myLayer.Symbolizer.Scheme.Categories(0).Range = New Range(3200, 3450)
        'myLayer.Symbolizer.Scheme.Categories(0).ApplyMinMax(myLayer.Symbolizer.EditorSettings)
        'myLayer.Symbolizer.Scheme.Categories(1).Range = New Range(3440, 3700)
        'myLayer.Symbolizer.Scheme.Categories(1).ApplyMinMax(myLayer.Symbolizer.EditorSettings)
        'myLayer.Symbolizer.ShadedRelief.ElevationFactor = 1
        'myLayer.Symbolizer.ShadedRelief.IsUsed = True
        'myLayer.WriteBitmap()

        'Quantile Breaks
        myLayer.Symbolizer.EditorSettings.IntervalMethod = IntervalMethod.Quantile
        myLayer.Symbolizer.EditorSettings.NumBreaks = 5
        myLayer.Symbolizer.Scheme.CreateCategories(myLayer.DataSet)
        myLayer.Symbolizer.ShadedRelief.ElevationFactor = 1
        myLayer.Symbolizer.ShadedRelief.IsUsed = True
        myLayer.WriteBitmap()
    End Sub
End Class
~AGP

Viewing all articles
Browse latest Browse all 3973

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>