Subscribe to this thread
Home - General / All posts - Big Grey AOI Button
AR_Rick

128 post(s)
#09-May-08 19:31

In the spirit of Friday evening sharing and a hopefully great weekend, I've zipped up a really simple, ridiculously useful add-in for people who use drawings linked with an Area of Interest. When pressed, the big grey AOI button will refresh the linked drawing you have open with the Area of Interest of the current viewport. For Map components, it will go through each layer and refresh those AOI'd layers with the correct viewport as well. Just unpack the AOIUpdate folder into your Config directory inside of the Manifold System folder. Restart Manifold and the button will appear, undocked, as always. Link in some layers with an Area of Interest and click the button. It's kind of addicting.

Attachments:
aoi_button.zip

Graeme

990 post(s)
#10-May-08 00:56

Very generous - thanks a lot for this!

We don't tend to use AOI much - but just had to try this out. On a laptop with XP Pro 32 bit and Oracle 10g, it worked first time - terrific stuff!

KlausDE

6,410 post(s)
#10-May-08 01:57

Thx Rick. Worked without any complains with a drawing linked from PostGIS and considered a different projection of map window and drawing.


Do you really want to ruin economy only to save the planet?

James

326 post(s)
#12-May-08 01:30

Rick thanks for this....excellent tool and works without a hitch. As much as I like Manifolds database support the one thing it has not achieved yet is dynamic area of interest windowing. This tool is the next best thing and lets me quickly load snapshots of database information for the current view in a map.

AR_Rick

128 post(s)
#12-May-08 14:08

BTW - I've been told by Manifold support that an upcoming Manifold 8 update will fix the issue where the custom toolbar is undocked on startup.

KlausDE

6,410 post(s)
#13-May-08 14:48

Rick, I've added a reference to the Add-Ins page on Manipedia (where everybody is invited to deposite the pearls he would like to recover in an index).


Do you really want to ruin economy only to save the planet?

AR_Rick

128 post(s)
#13-May-08 18:00

Does the Forum software archive ZIP files forever? You're welcome to copy it if you need to. The software is released as public domain.

adamw


10,447 post(s)
#14-May-08 00:35

Yes, for some values of "forever". We plan to keep every uploaded attachment available for the foreseeable future.

spoedniek

364 post(s)
#14-May-08 23:53

Just to add my thanks for this tool. I'm using it with my Postgres/Postgis database and it works perfectly. Very useful, thanks.

Henry

jkelly


1,234 post(s)
#18-May-08 16:26

I too would like to convey thanks. So simple.

A note for PostGIS users, this runs even faster if you rename the extents() function within PostGIS to something else. The slowest part of data retieval from postGIS is Manifold running the extents() aggregate function before dragging in the data.

AR_Rick suggested this in a thread with me ages ago, which I stupidly chose to ignore at the time, but now realise this add-on solves all my problems.


James Kelly

http://www.locationsolve.com

udai47 post(s)
#20-May-08 19:17

I renamed the extents() function in Postgres 8.2, and it worked very well. I cannot find the extents() function in a later version, though (8.3 with the bundled PostGIS version). However, I might add that the newer version is quicker to determine the bounds of the data than the older version without renaming extents() function.

Any thoughts/guidance appreciated.

Cheers

jkelly


1,234 post(s)
#20-May-08 19:31

How are you viewing the postgres database. If you are using pgAdmin III, then the default setting for items you can view doesn't include aggregate queries (amongst a few other things). Go File - Options - Display and turn on the aggregates.

You could of course just use SQL to rename it.

--sQL (within postgres)

alter AGGREGATE extent(geometry) RENAME TO _extent

 

cheers

James


James Kelly

http://www.locationsolve.com

udai47 post(s)
#20-May-08 20:56

Thank you so much. I was using pgAdmin III.

Cheers

KlausDE

6,410 post(s)
#21-May-08 02:37

To folow up:

Is it OK to rename aggregate extent() only and not the identical copy st_extent(). Thought the st_ prefix is the new notation. How do you log what Manifold acually calls?


Do you really want to ruin economy only to save the planet?

AR_Rick

128 post(s)
#21-May-08 07:26

I believe one is an aggregate and one only works on a single geometry object. You can increase Postgres' logging verbosity to include all executed queries and really see how sloppy and inefficient Manifold's generated lowest-common-denominator SQL is :)

KlausDE

6,410 post(s)
#21-May-08 08:25

Thx, I'll check logging levels.

This site and some PostGIS "What's new" that I don't remember made me think of extent() as deprecated for future use.


Do you really want to ruin economy only to save the planet?

adamw


10,447 post(s)
#21-May-08 22:26

Are you talking about SQL used during a handshake (which I agree is sloppy and is something we are going to improve in the future) or SQL used during editing?

adamw


10,447 post(s)
#21-May-08 23:22

Never mind, I have found your other thread.

Sloots

678 post(s)
#24-Mar-09 03:53

Thanks Rick for this great tool. It is very useful for me. I did encouter a drawback... themes where not supported.

I've made some changes to your script. When it encounters a theme (either directly or as a layer in a map component) it will update the owned drawing. This might be useful for other users as well.

Chris

Attachments:
AOIUpdate.zip


http://www.mppng.nl/manifold/pointlabeler

jnorman

222 post(s)
#26-Mar-09 11:27

Thanks to you both -- This works great! It is exactly what I needed today. Hope to return the favor some day.

John


"A child of five would understand this. Send someone to fetch a child of five." -- Groucho Marx

Sloots

678 post(s)
#09-Jul-10 04:32

I use the AOIUpdate tool a lot and it was until last week that I discovered a "unnecessary feature" ;-). When a map contains several themes that share the same owner drawing that drawing is synchronized multiple times.

Especially when the drawing is large (or you network connection is very slow) this is a waist of time.

Please find attached an update of this tool that updates a drawing only once.

Cheers

Chris

Attachments:
AOIUpdate.zip


http://www.mppng.nl/manifold/pointlabeler

cartomatic

905 post(s)
#09-Jul-10 04:41

That's what I was about to 'fix' for my next project too. Thanks for the upgrade!


maps made easy - www.cartomatic.pl || www.cartoninjas.net

cartomatic

905 post(s)
#03-Apr-14 15:46

In a case manifold does not recognise the srid of linked data, it resets a cs of a linked drawing to lon/lat upon data refresh. So this little update makes sure drawing's cs remains the same. It also restores the window scale in a case it changes on the way.

Attachments:
AOIUpdate.zip


maps made easy - www.cartomatic.pl || www.cartoninjas.net

sunsong

489 post(s)
#03-Apr-14 22:06

I tried the Big AOI button when it originally appeared here and did not get it to function. Now it's time to try again.

Manifold is closed. (Using 8.0.28.0 Universal on Win 7 Pro SP1, 64-bit)

I have placed the folder "AOIUpdate" in the Program Files\ Manifold System \config folder for both 32 bit and 64 bit. I have ensured that it is not "blocked" from being a download. (It was not "blocked" but did have "read only" which I removed after the first failure).

restarted Manifold.

I do not get an AOI button in either 64 bit or 32 bit. On the Tools, Add-Ins menu there is an entry for Quick AOI Update. When I click it I get an error window saying

  • Manifold System; Can't launch script.

In the error pane I receive two errors:

  • line 106, position 9: The type or namespace name 'var' could not be found (are you missing a using directive or an assembly reference?) CS0246
  • line 113, position 34: Cannot implicitly convert type 'var' to 'Manifold.Interop.CoordinateSystem' CS0029

I have tried it with

  • a completely empty project

  • and with a map file containing one map component with several raster layers all linked to a PostgreSQL DB [EDIT v9.1.13 32 bit]. With the Map component open.

    I get the same errors in each case. I have tried it with both 64 bit and 32 bit Manifold.

    I must be missing something trivial.

  • adamw


    10,447 post(s)
    #04-Apr-14 10:13

    Can it be that the extraction process placed the actual add-in files into ~\AOIUpdate\AOIUpdate folder (where ~ is the Manifold config folder), with two levels of folders instead of one? The files should be in ~\AOIUpdate, because that's the path cited in the XML.

    I can see the button (well, the menu command: Tools - Add-Ins - Quick AOI Update) just fine on my test system, tried 64-bit flavor of Manifold only, blank MAP file.

    Added:

    Sorry, I can't read, you get the menu command as well, it just seems to throw an error. It doesn't throw an error for me with a blank MAP file, but I will check further and report what I find.

    Also, unrelated, there's 8.0.29.

    adamw


    10,447 post(s)
    #04-Apr-14 10:33

    OK, the errors that you get are indeed because you are running 8.0.28 (and so the addin gets .NET 2.0 instead of .NET 4.0, and .NET 2.0 doesn't know what "var" is, etc). You have to upgrade to 8.0.29 to use the addin.

    But that's not all, there's also an error in the addin. Instead of creating a new Application object like this:

    //C#.NET

    app = new Manifold.Interop.Application();

    ...it should use the one created for it by the code that calls the addin from Manifold, otherwise it won't get to the active window:

    //C#.NET

    app = Context.Application;

    I don't see any other issues with the code right away, maybe there's something else.

    cartomatic

    905 post(s)
    #04-Apr-14 12:08

    actually it gets the active window. well at least on my side (i know, i know ;)

    But since you say it should not work I am wondering whether this is a feature or not. Please create a standard c# script component and replace its content with the code below. While it reports apps and docs not being the same instances, the remaining feedback seems not to confirm this:

    using Manifold.Interop.Scripts;

    using Manifold.Interop;

    using System;

    using System.Collections.Generic;

    class Script {

      static void Main()

        {

            var app1 = Context.Application;

            var app2 = new Application();

            //test if the apps objects are the same

            app1.MessageBox("App1 equals app2: " + app1.Equals(app2) + "; App2 equals app1: " + app2.Equals(app1));

            //Active doc

            var doc1 = (Document)app1.ActiveDocument;

            var doc2 = (Document)app2.ActiveDocument;

            app1.MessageBox("Doc1 equals doc2: " + doc1.Equals(doc2) + "; Doc2 equals doc1: " + doc2.Equals(doc1));

            //add a temp component with a test name to doc1

            var drw1 = doc1.NewDrawing("TestDrw", app1.DefaultCoordinateSystem, false);

            //and to doc2

            var drw2 = doc2.NewDrawing("TestDrw", app2.DefaultCoordinateSystem, false);

            //open drw1

            drw1.Open();

            //get active windows

            var aw1 = app1.ActiveWindow;

            var aw2 = app2.ActiveWindow;

            app1.MessageBox("Active window1 equals window2: " + aw1.Equals(aw2) + "; Active window2 equals window1: " + aw2.Equals(aw1));

            //compset count

            app1.MessageBox("Compset1 count: " + doc1.ComponentSet.Count + "; Compset2 count: " + doc2.ComponentSet.Count);

            

            //get the names of components in compsets

            var comps1 = new List();

            foreach (Component c in doc1.ComponentSet)

            {

                comps1.Add(c.Name);

            }

            var comps2 = new List();

            foreach (Component c in doc2.ComponentSet)

            {

                comps2.Add(c.Name);

            }

            //compset names

            app1.MessageBox(

                "Componenets in compset1: " + string.Join(", ", comps1) + Environment.NewLine +

                "Componenets in compset2: " + string.Join(", ", comps2)

            );

            app1.MessageBox("Component names seem to be the same: " + (string.Join(", ", comps1) == string.Join(", ", comps2)));

        }

    EDIT: v 8.0.29.0


    maps made easy - www.cartomatic.pl || www.cartoninjas.net

    adamw


    10,447 post(s)
    #04-Apr-14 12:54

    Well, if I try to launch it as is, it doesn't launch, because "new List()" lacks a type specialization (the error message is: "Using the generic type 'System.Collections.Generic.List<T>' requires 1 type arguments CS0305", there are two such errors).

    If I add a type specialization ("new List()" -> "new List<string>()"), it reports False / False in the first message box (what I would expect), reports False / False in the second message box (same), and then it dies on the line where it tries to create a new drawing using doc2 (also as I would expect).

    What happens on your system?

    adamw


    10,447 post(s)
    #04-Apr-14 13:39

    Actually, I probably know what happens on your system - the Application objects are different, the Document objects are different, the Window objects are different, but both Document objects refer to the same document entity, both Window objects refer to the same window entity, etc, and so it all works.

    The results I reported before were on my dev machine, the results on a clean test system are similar to yours. The difference is in the configuration - the configuration on my dev machine differs from the default, and, yes, changes to the configuration that I have should never be part of configuration on regular systems.

    In sum, doing "new Application()" in the context of an addin should be fine, it's not an error, I was wrong, sorry for that (teaches me to never take shortcuts and verify everything on a clean test system). Using "Context.Application" is better and more efficient, but not required.

    cartomatic

    905 post(s)
    #04-Apr-14 14:43

    yep, the <string> got cut while pasting somehow. must be the < and > that has been treated as a tag.

    locally apps, documents and active windows are not the same instances, then comparing the coponent names and counts suggests what you say.

    thanks for the confirmation


    maps made easy - www.cartomatic.pl || www.cartoninjas.net

    sunsong

    489 post(s)
    #08-Apr-14 19:30

    As you suggest, updating to 8.0.29 gets rid of the errors, thanks.

    I still do not see any AOI button. "Quick AOI Update" is in the Tools, Add-Ins menu and if I turn on the "Custom" toolbar (Tools, Customize, Toolbars, check Custom) I do see a small AOI button in that. Both of these function.

    I have never got the AOI function in Manifold to work as I expect. Most of the time it returns an empty component despite having set boundaries that include the majority of the objects in a drawing (e.g. 760 of 817). I will need to do further testing on this before I can state more clearly what is happening. I will start a separate topic on the forum. I get this same behaviour for both the AOI button and linking via the Database Console with "Use objects in the following area". Being able to use the AOI button will certainly make doing some testing much simpler. Thanks

    Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.