AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Maptitude über OLE/COM steuern

Ein Thema von DCoderHH · begonnen am 19. Mär 2015 · letzter Beitrag vom 1. Apr 2015
Antwort Antwort
DCoderHH

Registriert seit: 4. Feb 2015
Ort: Hamburg
84 Beiträge
 
Delphi 10 Seattle Professional
 
#1

Maptitude über OLE/COM steuern

  Alt 19. Mär 2015, 15:03
Hallo,

steuert hier jemand Maptitude über OLE/COM? Ich möchte eine Karte öffnen (das klappt) und dort ein Zeichen in einer bestimmten Schriftart einfügen. Den Code dazu habe ich teilweise aus der Hilfedatei nach Delphi übersetzt (hoffentlich richtig). Es läßt sich compilieren. Beim Ausführen erscheint jedoch an der Stelle "Hier der Fehler" die folgende Meldung:

Code:
C:\Users\NAME\AppData\Roaming\Caliper\Maptitude 2015\caliper.mrk was not found.
Diese Datei existiert nach einer frischen Maptitude Installation auf der gesamten Festplatte nicht. Ich vermute daher, dass der Fehler ein anderer ist und die Meldung nicht ganz stimmt. Wer kann helfen? Oder hat für mich ein anderes Beispiel, wie ich eine Maptitude-Karte von Delphi aus bearbeiten kann? Danke!


Delphi-Quellcode:
procedure TForm1.Test;
var
  spec, specSub, MapScope, Location, Color: OleVariant;
  MapName: string;
  Gisdk: OleVariant;
begin

  Gisdk := CreateOleObject('Maptitude.AutomationServer');
  Gisdk.RunMacro('OpenMap', 'D:\test.map', null);
  Gisdk.RunMacro('SetWindowSizePixels', null, 340, 270);
  Gisdk.RunMacro('SetLayer', 'Cities & Towns');

  MapName := Gisdk.RunMacro('GetMap');

    spec := VarArrayCreate([1, 4], varVariant);

    Location := Gisdk.RunMacro('Coord', -75000000, 43000000);
    spec[1] := VarArrayCreate([1, 2], varVariant);
    specSub := spec[1];
    specSub[1] := 'Location';
    specSub[2] := Location;

    spec[2] := VarArrayCreate([1, 2], varVariant);
    specSub := spec[2];
    specSub[1] := 'Font';
    specSub[2] := 'Caliper Cartographic|14';

    spec[3] := VarArrayCreate([1, 2], varVariant);
    specSub := spec[3];
    specSub[1] := 'Index';
    specSub[2] := '53';

    Color := Gisdk.RunMacro('ColorRGB', 0, 0, 65535);
    spec[4] := VarArrayCreate([1, 2], varVariant);
    specSub := spec[4];
    specSub[1] := 'Color';
    specSub[2] := Color;

    try
      Gisdk.RunMacro('AddAnnotation', 'Map|'+MapName, 'Font Character', spec); //<-- Hier der Fehler
    except
      MessageDlg(Gisdk.RunMacro('GetLastError', null), mtError, [mbOK], 0);
    end;
end;
  Mit Zitat antworten Zitat
Maptitude

Registriert seit: 23. Mär 2015
4 Beiträge
 
#2

AW: Maptitude über OLE/COM steuern

  Alt 23. Mär 2015, 17:31
We believe you are simply seeing the last error message left over from the application start-up (it tries to load bookmarks but none have been created yet).

The error is unrelated to your custom code.

Perhaps the problem is that the value of the Index option should be an integer, but you are using a string
  Mit Zitat antworten Zitat
DCoderHH

Registriert seit: 4. Feb 2015
Ort: Hamburg
84 Beiträge
 
Delphi 10 Seattle Professional
 
#3

AW: Maptitude über OLE/COM steuern

  Alt 25. Mär 2015, 07:36
Hi, thank you very much for your reply

We believe you are simply seeing the last error message left over from the application start-up (it tries to load bookmarks but none have been created yet).

The error is unrelated to your custom code.
If I start Maptitude without my application then no error message is displayed.

Perhaps the problem is that the value of the Index option should be an integer, but you are using a but you are using a string
I have changed the line
specSub[2] := '53'; to
specSub[2] := 53;
But the error is the same.

Gisdk.RunMacro raises this EOleException:
Code:
'AddAnnotation returned an error. (1)'
and GetLastError shows the error message as I have written in my first post.
  Mit Zitat antworten Zitat
Maptitude

Registriert seit: 23. Mär 2015
4 Beiträge
 
#4

AW: Maptitude über OLE/COM steuern

  Alt 25. Mär 2015, 13:42
Another problem is the first parameter in the call to AddAnnotation - instead of

‘Map |’ + MapName

it should be

‘Map|’ + MapName

i.e. no space character between ‘Map' and ‘|'
  Mit Zitat antworten Zitat
DCoderHH

Registriert seit: 4. Feb 2015
Ort: Hamburg
84 Beiträge
 
Delphi 10 Seattle Professional
 
#5

AW: Maptitude über OLE/COM steuern

  Alt 25. Mär 2015, 13:51
Another problem is the first parameter in the call to AddAnnotation - instead of

‘Map |’ + MapName

it should be

‘Map|’ + MapName

i.e. no space character between ‘Map' and ‘|'
Thanks, but in my code is no space character:

Gisdk.RunMacro('AddAnnotation', 'Map|'+MapName, 'Font Character', spec);

(You can copy and paste it to notepad to check it. The pipe | character has some white space arround it. It may look like a space character. But it isn't)
  Mit Zitat antworten Zitat
DCoderHH

Registriert seit: 4. Feb 2015
Ort: Hamburg
84 Beiträge
 
Delphi 10 Seattle Professional
 
#6

AW: Maptitude über OLE/COM steuern

  Alt 25. Mär 2015, 15:01
I have created a bookmark with Maptitude as a workaround. Now there is a file called caliper.mrk. The error message
Code:
C:\Users\NAME\AppData\Roaming\Caliper\Maptitude 2015\caliper.mrk was not found.
is gone now. But Gisdk.RunMacro raises still this EOleException:
Code:
'AddAnnotation returned an error. (1)'
But GetLastError returns another message now:
Code:
Cannot find resource Matrix.
What is the problem here? Thank you in advance
  Mit Zitat antworten Zitat
Maptitude

Registriert seit: 23. Mär 2015
4 Beiträge
 
#7

AW: Maptitude über OLE/COM steuern

  Alt 25. Mär 2015, 19:02
Please ignore what GetLastError is reporting - these are leftover expected errors that are thrown during the application initialization. These errors have no connection with the problem you are experiencing.
  Mit Zitat antworten Zitat
DCoderHH

Registriert seit: 4. Feb 2015
Ort: Hamburg
84 Beiträge
 
Delphi 10 Seattle Professional
 
#8

AW: Maptitude über OLE/COM steuern

  Alt 26. Mär 2015, 08:04
Please ignore what GetLastError is reporting - these are leftover expected errors that are thrown during the application initialization. These errors have no connection with the problem you are experiencing.
OK, I ignore GetLastError now. But how to fix the problem? The OLE-Exception is still there and AddAnnotation is not executed. It would be helpful if you would provide me a working demo. You can downlaod a free demo version of Delphi at www.embarcadero.com and try to build a working demo.

We have bought 2 licenses of Maptitude. If we get it working many of our customers will buy a license too! This 100% sure

Geändert von DCoderHH (26. Mär 2015 um 13:04 Uhr)
  Mit Zitat antworten Zitat
Maptitude

Registriert seit: 23. Mär 2015
4 Beiträge
 
#9

AW: Maptitude über OLE/COM steuern

  Alt 26. Mär 2015, 18:24
Hi:

Please review this thread: https://groups.yahoo.com/neo/groups/...ns/topics/4498

The group is a good resource for developers of Maptitude. However, we would be happy to help further.
  Mit Zitat antworten Zitat
DCoderHH

Registriert seit: 4. Feb 2015
Ort: Hamburg
84 Beiträge
 
Delphi 10 Seattle Professional
 
#10

AW: Maptitude über OLE/COM steuern

  Alt 1. Apr 2015, 10:00
I've joined the Maptitude Yahoo group. But I can't write a new post. Is it possible that you (or a moderator) give me write access to this group? Thanks!
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:02 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz