Changes between Version 3 and Version 4 of CodeSamples/ASP.Net/ScribbleApp


Ignore:
Timestamp:
Nov 21, 2007, 11:02:47 AM (16 years ago)
Author:
jbirch
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CodeSamples/ASP.Net/ScribbleApp

    v3 v4  
    33This page is one of the !MapGuide Community CodeSamples.  Visit the CodeSamples page to view more!
    44
    5 == Dennis' Cool Application ==
     5== About Scribble ==
     6
     7Scribble was designed to be an adjunct to any map/layout we created here at MIA. A “kinda-sorta” universal plugin application for pdf output and html table output from a MG selection. The markup came along as part of the generalization process.
     8
     9== Acknowledgements ==
     10
     11First and foremost I must acknowledge the following legends of the open source community:
     12
     13iText – Bruno Lowagie and Paulo Soares
     14http://www.lowagie.com/iText/
     15I am amazed at how many commercial packages are based on and actually include this work.
     16
     17IKVM – Jeroen Frijiters
     18http://www.ikvm.net/
     19Pretty much single-handedly brought on the demise of Microsoft’s J#
     20
     21== Requirements ==
     22
     23Here is the platform information:
     24      MapGuide Open Source 1.1
     25      Windows XP
     26      Windows Server 2003
     27      .Net Framework 2.0
     28      Visual Studio 2005
     29      ASP.NET Ajax 1.0
     30      ASP.NET 1.0 AjaxControlToolkit - http://www.codeplex.com/
     31
     32I also borrowed extensively from the “gt” MGOS sample application. Easily said that this was the starting point for the geometry portion of this application.
     33 
     34== Notes ==
     35
     36This application was designed to run within the taskFrame of MG as an iframe within an AjaxlToolkit TabPanel. Specifically I set this up to be instantiated thusly:
     37
     38{{{
     39        HtmlControl frame1 = new System.Web.UI.HtmlControls.HtmlGenericControl("iframe");
     40        frame1.Attributes["src"] = "http://" + dnsname + "/mapguide/Scribble/scribble.aspx?SESSION="
     41                                    + args["SESSION"] ;
     42        frame1.Attributes["frameborder"] = "0";
     43        frame1.Attributes["scrolling"] = "auto";
     44        frame1.Attributes["width"] = "100%";
     45        frame1.Attributes["height"] = "400px";
     46        frame1.Attributes["allowTransparency"] = "true";
     47        theFrameScribble.Controls.Add(frame1);
     48}}}
     49
     50This then explains the “parent.parent.parent.mapFrame” references within the javascript.
     51
     52Needless to say you may do what you wish. (As an aside, I actually have 4 separate applications in 4 tabpanels all interacting with the map).
     53
     54=== Preparing iText and IKVM ===
     55
     56This step is optional, since the DLLs are included in the package, but worth understanding.
     57
     58If you know nothing of [http://www.lowagie.com/iText/ iText] and [http://www.ikvm.net/ IKVM] I recommend you spend some time reading.  These apps are impossible to explain in a few words. I will just tell you what I have done.
     59
     60I used the following ikvmc commands to create the itext and bouncycastle dll’s
     61{{{
     62 ::REM
     63 ikvmc -target:library -reference:IKVM.GNU.Classpath.dll bcpg-jdk15-137.jar
     64 ikvmc -target:library -reference:IKVM.GNU.Classpath.dll -reference:bcpg-jdk15-137.dll bctsp-jdk15-137.jar
     65 ikvmc -target:library -reference:IKVM.GNU.Classpath.dll -reference:bcpg-jdk15-137.dll -reference:bctsp-jdk15-137.dll bcprov-jdk15-137.jar
     66 ikvmc -target:library -reference:IKVM.GNU.Classpath.dll -reference:bcpg-jdk15-137.dll -reference:bctsp-jdk15-137.dll -reference:bcprov-jdk15-137.dll bcmail-jdk15-137.jar
     67
     68 :: FINALLY
     69 ikvmc -target:library -reference:IKVM.GNU.Classpath.dll -reference:bcmail-jdk15-137.dll -reference:bcprov-jdk15-137.dll itext-2.0.6.jar
     70 ::REM
     71
     72}}}
     73
     74THAT’S IT !!!! You just created .NET dll’s from jars!!
     75(As another aside: there are LOTS of GIS related jars out there)
     76
     77Do NOT be overly concerned with the warnings coming out of bouncycastle. Most of these have to do with encryption and stamping and mailing. I do not understand fully but I never have had to use those methods anyway. Please keep in mind the older iText stuff works great to! I have used versions from 1.4 – 2.0 without any difficulty. Again the bouncycastle stuff is recent. You are going to be amazed at how simple this really is!!
     78
     79I currently use these dll’s
     80{{{
     81 itext-2.0.6.dll
     82 IKVM.Runtime.dll
     83 IKVM.GNU.Classpath.dll
     84 bcprov-jdk15-137.dll
     85 bcmail-jdk15-137.dll
     86}}}
     87
     88Drop these dll’s into your applications bin directory, make your references to them and start “using”
     89using java.io;
     90using ikvm.lang;
     91using com.lowagie.text;
     92using com.lowagie.text.pdf;
     93using com.lowagie.text.pdf.codec;
     94
     95=== Getting Started with Scribble ===
     96
     97Take a look at scribblemethodsmgr.cs and most everything will become obvious.
     98(For all you .NET purists out there the [WEBMETHOD] decoration on some of these methods is pointless I know, but it looks nice.)
     99
     100{{{
     101 public byte[] MaterializeMapImagePage(string session, string mapname, int width, int height, string imageflavor)
     102}}}
     103
     104 AND
     105
     106{{{
     107public byte[] MaterializeMapPDFPage(string session, string mapname, int width, int height, string imageflavor)
     108}}}
     109
     110If you don’t like my approach in using ajax calls just rip out the pdf creation stuff and put it directly into the .ashx helper. This will work just as well and you won’t have to be bothered with the other stuff. I just like keeping the file count down and like the consolidation of codebehind  that my approach gives. To each is own.
     111
     112I have zipped up just the source and the overall structure so you will be able to get a feel of the overall architecture.  I also included the web.config and put it into a separate directory.
     113
     114Enjoy ....
     115dennis