Seite 1 von 1

Mappoint ObjectsFromPoint(X, Y) vs. Nearby()

Verfasst: Fr, 17. Okt 2008 11:35
von AUGE_OHR
hi,

Code: Alles auswählen

    'Namen jedes Objekts anzeigen, auf das der Benutzer auf der Karte klickt
    Set objResults = objMap.ObjectsFromPoint(X, Y)
    For Each objResult In objResults
      MsgBox objResult.Name
    Next
daraus hab ich dann

Code: Alles auswählen

   IF VALTYPE(oResult) = "O"
      iMax := oResult:Count()
      IF iMax > 0
         i := 1
         FOR i := 1 TO iMax-1
            SLEEP(40)
            oWhat := oResult:Item(i)
ALTD()
            cName := UPPER( oWhat:interfaceName() )
            IF cName = "PUSHPIN"
            ...
            ELSEIF cName = "LOCATION"
            ...   
sowas gemacht. Das Problem : "irgendwann" meckert er :Item(i) an ... mit hohen i Werten.

nun hab ich beim suchen folgendes entdeckt

Code: Alles auswählen

// try to find the Country, State, County
FindResults findResults = 
    MP.ActiveMap.ObjectsFromPoint(MP.ActiveMap.LocationToX(loc), MP.ActiveMap.LocationToY(loc));

try
{
    // known problem with MapPoint -- iterator may throw exception at end
    foreach (object o in findResults) 
    {
        MapPoint.Location locR = o as MapPoint.Location;
        if ( locR == null ) continue;
        MapPoint.GeoShowDataBy locType = locR.Type;
        switch ( locR.Type )
        {
            case GeoShowDataBy.geoShowByCountry:
                this.Country    = locR.Name;
                break;
            case GeoShowDataBy.geoShowByRegion1:
                this.State    = locR.Name;
                break;
            case GeoShowDataBy.geoShowByRegion2:
                this.County    = locR.Name;
                break;
            case GeoShowDataBy.geoShowByCity:
                break;
        }
    }
}
catch (Exception)    // ignore exception
{ }
was ist try, continue, switch und catch ? kann mir das jemand nach Xbase++ übersetzten ?

was ich noch nicht ganz verstehe : ObjectsFromPoint() soll mir ja ein FindResult Auflistung geben
welche Location und Pushpin sein können ... und sonst noch was ?

mit :NearBy bekomme nun ebenfalls eine FindResult Auflistung welche PlaceCategory Objekt hat.
Wenn ich vorher alle Places manuelle in der Original Version "deselektiert" habe dann erscheinen
nur noch "Meine Pins". wie kann ich das "deselektieren" per activeX machen ?

Re: Mappoint ObjectsFromPoint(X, Y) vs. Nearby()

Verfasst: Di, 21. Okt 2008 5:25
von Martin Altmann
Hallo Jimmy,
AUGE_OHR hat geschrieben:was ist try, continue, switch und catch ? kann mir das jemand nach Xbase++ übersetzten ?
komisch, dass noch keiner geantwortet hat - ist hier niemand, der C# kann?
Also - ist zwar schon eine ganze Weile her, aber hier mal mein Versuch:
switch -> do case
continue -> überspringt den nachfolgenden Block (Schleife, Iteration, was auch immer) komplett! In dem Fall wird also der switch (do case...) für das aktuelle Objekt nicht gemacht, falls locR null ist...
try-catch -> entspricht unserem Errorhandler. Unter try kommt der Bereich, der bei uns im Prinzip durch BEGIN SEQUENCE...END SEQUENCE eingeschlossen ist und catch entspricht dann unserem RECOVER USING...

Viele Grüße,
Martin

Re: Mappoint ObjectsFromPoint(X, Y) vs. Nearby()

Verfasst: Mi, 22. Okt 2008 5:16
von AUGE_OHR
hi,
Martin Altmann hat geschrieben: komisch, dass noch keiner geantwortet hat - ist hier niemand, der C# kann?
oder es interessiert keinen ...
Martin Altmann hat geschrieben: Also - ist zwar schon eine ganze Weile her, aber hier mal mein Versuch:
switch -> do case
continue -> überspringt den nachfolgenden Block (Schleife, Iteration, was auch immer) komplett! In dem Fall wird also der switch (do case...) für das aktuelle Objekt nicht gemacht, falls locR null ist...
try-catch -> entspricht unserem Errorhandler. Unter try kommt der Bereich, der bei uns im Prinzip durch BEGIN SEQUENCE...END SEQUENCE eingeschlossen ist und catch entspricht dann unserem RECOVER USING...
ok danke das hilft mir doch schon mal weiter. Ich muss mir wohl auch C# aneignen.