Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

A COM addin for quickly moving groups of points from dataset to dataset

This is a discussion on A COM addin for quickly moving groups of points from dataset to dataset within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hello again, After much struggling with casting in VB6 I have decided to switch platforms. I chose .NET for the ...

  1. #11
    Conor is offline Junior Member Yellow Belt
    Join Date
    Jun 2010
    Posts
    17

    Re: A COM addin for quickly moving groups of points from dataset to dataset

    Hello again,

    After much struggling with casting in VB6 I have decided to switch platforms. I chose .NET for the sake of simplicity and availability. The issue I have been continually running into is passing the correct values that represent my polygon (the selected polygon) into the QueryPolygon method. The code below uses the generic IEnumerator function to traverse the vertices stored into System.array.



    Code:
            Dim arrSys As System.Array
            Dim ienumSysColl As System.Collections.IEnumerator
            Dim intPointCount As Long
            Dim objLoc As MapPoint.Location
            Dim objShape As MapPoint.Shape
            Dim lngCount As Long
            lngCount = 0
    
            For Each objShape In oMap.Selection
    
                arrSys = objShape.Vertices
                ienumSysColl = arrSys.GetEnumerator
                intPointCount = UBound(objShape.Vertices)
    
                For i = 0 To intPointCount
    
                    ienumSysColl.MoveNext()
                    objLoc = ienumSysColl.Current
    
    
                Next
    
            Next
    
    objRecords = objDataSet.QueryPolygon(objLoc)
    
    objRecords.MoveFirst()
            Do While Not objRecords.EOF
                lngCount = lngCount + 1
                objRecords.MoveNext()
            Loop
    
            MsgBox("Number of records in polygon: " & lngCount)
    The program compiles fine, but does nothing upon running. No error message either. Thoughts?

    Conor

  2. #12
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: A COM addin for quickly moving groups of points from dataset to dataset

    Have you tried stepping through with a debugger? This might indicate why i isn't doing anything - eg. is an object reference set to null, or is UBound returning 0?


    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  3. #13
    Conor is offline Junior Member Yellow Belt
    Join Date
    Jun 2010
    Posts
    17

    Re: A COM addin for quickly moving groups of points from dataset to dataset

    Success! Function a is now completed and working. Here is the relevant code (in VB6) for anyone who is interested. This code simply loops over all the records in an already drawn and selected shape (rectangle, circle, freeform) and returns the number of records in the shape.

    Code:
       
        Dim oMap As MapPoint.Map
        Dim objDataSet As MapPoint.DataSet
        Dim objRecords As MapPoint.Recordset
        Dim objLoc As MapPoint.Location
        Dim objShape As MapPoint.Shape
        Dim lngCount As Long
       
        oApp.Visible = True
        oApp.UserControl = True
        Set oMap = oApp.ActiveMap
        lngCount = 0
        
        Set objShape = oMap.Selection
        objShape.Select
        Set objDataSet = oApp.ActiveMap.DataSets("Name of your dataset here")
        Set objRecords = objDataSet.QueryShape(objShape)
        
        objRecords.MoveFirst
        Do While Not objRecords.EOF
            lngCount = lngCount + 1
            objRecords.MoveNext
        Loop
        
        MsgBox "Number of records in shape: " & lngCount
    Now to begin work on function b of the program... Hopefully this part won't take as long.

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. dataSet.zoomTo()
    By chpw in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 05-17-2006, 07:05 AM
  2. Dataset rendering
    By Gianmaria in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 06-09-2005, 02:22 PM
  3. How do you add records to a dataset
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 05-03-2005, 03:09 PM
  4. Moving groups of pushpins to front
    By lane in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 03-10-2005, 12:07 PM
  5. Delete Pushpin from PushpinSet (or DataSet) prior to moving
    By SeanMcGinty in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 12-20-2004, 10:37 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127