[mapguide-commits] r7228 - in sandbox/jng/swig-java: BuildTools/WebTools/IMake BuildTools/WebTools/IMake/Win32 Web/src/DotNetApi/Foundation Web/src/DotNetApi/Geometry Web/src/DotNetApi/MapGuideCommon Web/src/DotNetApi/PlatformBase Web/src/DotNetApi/Web Web/src/DotNetUnmanagedApi/Foundation Web/src/DotNetUnmanagedApi/Geometry Web/src/DotNetUnmanagedApi/MapGuideCommon Web/src/DotNetUnmanagedApi/PlatformBase Web/src/DotNetUnmanagedApi/Web Web/src/JavaApiEx

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Nov 26 08:00:08 PST 2012


Author: jng
Date: 2012-11-26 08:00:07 -0800 (Mon, 26 Nov 2012)
New Revision: 7228

Modified:
   sandbox/jng/swig-java/BuildTools/WebTools/IMake/IMake.cpp
   sandbox/jng/swig-java/BuildTools/WebTools/IMake/Win32/IMake.exe
   sandbox/jng/swig-java/Web/src/DotNetApi/Foundation/FoundationMakefile
   sandbox/jng/swig-java/Web/src/DotNetApi/Geometry/GeometryMakefile
   sandbox/jng/swig-java/Web/src/DotNetApi/MapGuideCommon/MapGuideCommonMakefile
   sandbox/jng/swig-java/Web/src/DotNetApi/PlatformBase/PlatformBaseMakefile
   sandbox/jng/swig-java/Web/src/DotNetApi/Web/WebMakefile
   sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/Foundation/FoundationApiGen.xml
   sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/Geometry/GeometryApiGen.xml
   sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/MapGuideCommon/MapGuideCommonApiGen.xml
   sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/PlatformBase/PlatformBaseApiGen.xml
   sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/Web/WebApiGen.xml
   sandbox/jng/swig-java/Web/src/JavaApiEx/getclassid.code
   sandbox/jng/swig-java/Web/src/JavaApiEx/javaextensions.i
Log:
#9, #2114: 
 - Add IMake support for transplanting doxygen to .net XML documentation. Having this in IMake effectively eliminates the need for the DoxyTransform tool and the need for a doxygen XML output step that the DoxyTransform tools requires.
 - Update DotNetApi makefiles to include the /doc switch, that generates the XML documentation files
 - Update the DotNetApi gen xml files to include the _doc.i files
 - Fix bad getclassid JNI method for our enhanced java wrapper
 - Add more MapGuide collection classes with java.util.Collection support
 - Add stock equals() and hashCode() implementations for classes that are contained in collection classes. This is required for contains() and other equality/containment tests in the java collections API to work.
 - Fix bad ItemIterator behavior for java collection proxy classes
 - Fix bad toArray() implementation for collection proxy classes

Modified: sandbox/jng/swig-java/BuildTools/WebTools/IMake/IMake.cpp
===================================================================
--- sandbox/jng/swig-java/BuildTools/WebTools/IMake/IMake.cpp	2012-11-26 14:27:27 UTC (rev 7227)
+++ sandbox/jng/swig-java/BuildTools/WebTools/IMake/IMake.cpp	2012-11-26 16:00:07 UTC (rev 7228)
@@ -540,6 +540,72 @@
     return str.length() > 3; //A "///" does not count
 }
 
+string linkifyCSharpDocFragment(const string& str)
+{
+    // Explode the fragment into a space delimited list.
+    // Go through the delimited tokens and surround any
+    // token containing "Mg" with {@link <token>} 
+    //
+    // Re-combine each delimited token to form the linkified result
+    std::vector<std::string> elems;
+    std::stringstream ss(str);
+    std::string item;
+    while(std::getline(ss, item, ' ')) {
+        //We can't process these yet, so skip them as they may
+        //interfere with doxygen directive translation
+        if (item == "\\link" || item == "\\endlink")
+            continue;
+        elems.push_back(item);
+    }
+
+    std::string nspace = nameSpace;
+    if (nspace.empty()) //Faulty logic if this is the case
+        nspace = "OSGeo.MapGuide";
+
+    std::string output;
+    for (int i = 0; i < elems.size(); i++) {
+        if (i != 0) {
+            output.append(" ");
+        }
+        //If it contains "Mg", assume it's a MapGuide class name and link-ify it
+        //TODO: Resolve :: to member links. Right now it just linkifies the Mg class name
+        int idx = elems[i].find("Mg");
+        if (idx != std::string::npos) {
+            std::string prefix;
+            std::string mgClassName;
+            std::string suffix;
+            //Collect characters before Mg
+            if (idx > 0) {
+                prefix = elems[i].substr(0, idx);
+            }
+            int cont = -1;
+            //Collect the characters in the MapGuide class name
+            for (int j = idx; j < elems[i].length(); j++) {
+                if (!isalnum(elems[i][j])) {
+                    cont = j;
+                    break;
+                } else {
+                    mgClassName += elems[i][j];
+                }
+            }
+            //Collect any characters afterwards
+            for (int j = cont; j < elems[i].length(); j++) {
+                suffix += elems[i][j];
+            }
+            output.append(prefix);
+            output.append("<see cref=\"");
+            output.append(nspace);
+            output.append(".");
+            output.append(mgClassName);
+            output.append("\" />");
+            output.append(suffix);
+        } else {
+            output.append(elems[i]);
+        }
+    }
+    return output;
+}
+
 string linkifyJavaDocFragment(const string& str)
 {
     // Explode the fragment into a space delimited list.
@@ -643,9 +709,7 @@
     // \since - @since
     // \exception - @exception
 
-    //Re-tokenize the method declaration
-    //
-    //We want the bits between '(' and ')' (parentheses included) and the first token before the '('
+    //Re-tokenize the doxygen comments
     std::vector<std::string> elems;
     std::stringstream ss(commentStr);
     std::string item;
@@ -796,7 +860,185 @@
 
 string doxygenToCsharpDoc(const string& commentStr)
 {
-    return commentStr;
+    //See doxygenToJavaDoc for how we do this sorcery
+
+    std::string nspace = nameSpace;
+    if (nspace.empty()) //Faulty logic if this is the case
+        nspace = "OSGeo.MapGuide";
+
+    //Re-tokenize the doxygen comments
+    std::vector<std::string> elems;
+    std::stringstream ss(commentStr);
+    std::string item;
+    while(std::getline(ss, item, '\n')) {
+        elems.push_back(item);
+    }
+    int i = 0;
+    
+    bool isDeprecated = false;
+    std::vector<std::string> descriptionParts;
+    std::vector<std::string> paramParts;
+    std::vector<std::string> returnParts;
+    std::vector<std::string> exceptionParts;
+
+    while(i < elems.size()) {
+        if (elems[i].find("<!-- Syntax in .Net, Java, and PHP -->") != std::string::npos ||
+            elems[i].find("<!-- Example (PHP) -->") != std::string::npos ||
+            elems[i].find("<!-- Example (Java) -->") != std::string::npos ||
+            elems[i].find("<!-- Example (C#) -->") != std::string::npos) {
+            i++;
+            continue;
+        }
+
+        if (elems[i].find("\\brief") != std::string::npos) {
+            i++;
+            //Keep going until we find the next doxygen directive or end of comments
+            while (i < elems.size() && elems[i].find("\\") == std::string::npos) {
+                if (elems[i].find("<!-- Syntax in .Net, Java, and PHP -->") != std::string::npos ||
+                    elems[i].find("<!-- Example (PHP) -->") != std::string::npos ||
+                    elems[i].find("<!-- Example (Java) -->") != std::string::npos ||
+                    elems[i].find("<!-- Example (C#) -->") != std::string::npos) {
+                    i++;
+                    continue;
+                }
+                std::string token = elems[i].substr(3);
+                if (!token.empty())
+                    descriptionParts.push_back(token);
+                i++;
+            }
+            
+            continue;
+        }
+        else if (elems[i].find("\\param") != std::string::npos) {
+            std::string paramPart = elems[i].substr(elems[i].find("\\param") + 6);
+            paramPart.append(" ");
+            i++;
+            //Keep going until we find the next doxygen directive or end of comments
+            while (i < elems.size() && elems[i].find("\\") == std::string::npos) {
+                std::string token = elems[i].substr(3);
+                if (!token.empty()) {
+                    paramPart.append(token);
+                    paramPart.append(" ");
+                }
+                i++;
+            }
+            paramParts.push_back(paramPart);
+            continue;
+        }
+        else if (elems[i].find("\\return") != std::string::npos) {
+            i++;
+            //Keep going until we find the next doxygen directive or end of comments
+            while (i < elems.size() && elems[i].find("\\") == std::string::npos) {
+                if (elems[i].find("<!-- Syntax in .Net, Java, and PHP -->") != std::string::npos ||
+                    elems[i].find("<!-- Example (PHP) -->") != std::string::npos ||
+                    elems[i].find("<!-- Example (Java) -->") != std::string::npos ||
+                    elems[i].find("<!-- Example (C#) -->") != std::string::npos) {
+                    i++;
+                    continue;
+                }
+                std::string token = elems[i].substr(3);
+                if (!token.empty())
+                    returnParts.push_back(token);
+                i++;
+            }
+            continue;
+        }
+        else if (elems[i].find("\\deprecated") != std::string::npos) {
+            i++;
+            isDeprecated = true;
+            continue;
+        }
+        else if (elems[i].find("\\exception") != std::string::npos) {
+            std::string except = elems[i].substr(elems[i].find("\\exception") + 10);
+            exceptionParts.push_back(except);
+            i++;
+            continue;
+        }
+        i++;
+    }
+
+    // ---------------------- csharpDoc START ------------------------ //
+    std::string csharpDoc = "\n///<summary>\n";
+
+    if (descriptionParts.size() > 0) {
+        for (int i = 0; i < descriptionParts.size(); i++) {
+            csharpDoc.append("///");
+            csharpDoc.append(linkifyCSharpDocFragment(descriptionParts[i]));    
+            csharpDoc.append("\n");
+        }
+        csharpDoc.append("///</summary>\n");
+    } else {
+        csharpDoc.append("///TODO: API Documentation is missing or failed to translate doxygen brief directive (message inserted by IMake.exe)\n///</summary>\n");
+    }
+
+    if (paramParts.size() > 0) {
+        for (int i = 0; i < paramParts.size(); i++) {
+            std::vector<std::string> pelems;
+            std::stringstream pss(linkifyCSharpDocFragment(paramParts[i]));
+            std::string pitem;
+            while(std::getline(pss, pitem, ' ')) {
+                if (!pitem.empty())
+                    pelems.push_back(pitem);
+            }
+    
+            if (pelems.size() > 1) { //Should be
+                csharpDoc.append("///<param name=\"");
+                csharpDoc.append(pelems[0]);
+                csharpDoc.append("\">");
+                csharpDoc.append("\n///");
+                for (int i = 1; i < pelems.size(); i++) {
+                    csharpDoc.append(" ");
+                    csharpDoc.append(pelems[i]);
+                }
+                csharpDoc.append("\n///</param>\n");
+            }
+        }
+    }
+
+    if (returnParts.size() > 0) {
+        csharpDoc.append("///<returns>");
+        for (int i = 0; i < returnParts.size(); i++) {
+            csharpDoc.append(linkifyCSharpDocFragment(returnParts[i]));
+            if (i < returnParts.size() - 1)
+                csharpDoc.append("\n/// ");
+        }
+        csharpDoc.append("\n///</returns>\n");
+    }
+
+    if (exceptionParts.size() > 0) {
+        for (int i = 0; i < exceptionParts.size(); i++) {
+
+            std::vector<std::string> eelems;
+            std::stringstream ess(exceptionParts[i]);
+            std::string eitem;
+            while(std::getline(ess, eitem, ' ')) {
+                if (!eitem.empty())
+                    eelems.push_back(eitem);
+            }
+
+            csharpDoc.append("///<exception cref=\"");
+            csharpDoc.append(nspace);
+            csharpDoc.append(".");
+            if (eelems.size() > 1) {
+                csharpDoc.append(eelems[0]);
+                csharpDoc.append("\">");
+                for (int j = 1; j < eelems.size(); j++) {
+                    csharpDoc.append(" ");
+                    csharpDoc.append(eelems[j]);
+                }
+                csharpDoc.append("</exception>\n");
+            } else {
+                csharpDoc.append(eelems[0]);
+                csharpDoc.append("\"></exception>\n");
+            }
+        }
+    }
+
+    // ---------------------- csharpDoc END ------------------------ //
+    csharpDoc.append("///\n");
+    if (isDeprecated)
+        csharpDoc.append("[Obsolete(\"This method is deprecated\")]\n");
+    return csharpDoc;
 }
 
 void outputClassDoc(const string& className, const string& commentStr)

Modified: sandbox/jng/swig-java/BuildTools/WebTools/IMake/Win32/IMake.exe
===================================================================
(Binary files differ)

Modified: sandbox/jng/swig-java/Web/src/DotNetApi/Foundation/FoundationMakefile
===================================================================
--- sandbox/jng/swig-java/Web/src/DotNetApi/Foundation/FoundationMakefile	2012-11-26 14:27:27 UTC (rev 7227)
+++ sandbox/jng/swig-java/Web/src/DotNetApi/Foundation/FoundationMakefile	2012-11-26 16:00:07 UTC (rev 7228)
@@ -12,8 +12,8 @@
 release: $(OUTDIR)\OSGeo.MapGuide.Foundation.dll
 
 $(OUTDIR)\OSGeo.MapGuide.Foundation.Temp.dll:
-  csc.exe /debug+ /debug:full /optimize- /out:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll /platform:$(PLATFORM) /target:library .\*.cs
+  csc.exe /debug+ /debug:full /optimize- /out:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll /doc:$(OUTDIR)\OSGeo.MapGuide.Foundation.xml /platform:$(PLATFORM) /target:library .\*.cs
   copy /y $(OUTDIR)\OSGeo.MapGuide.Foundation.dll $(OUTDIR)\OSGeo.MapGuide.Foundation.Temp.dll
 
 $(OUTDIR)\OSGeo.MapGuide.Foundation.dll:
-  csc.exe /debug+ /debug:pdbonly /optimize+ /out:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll /platform:$(PLATFORM) /target:library .\*.cs
+  csc.exe /debug+ /debug:pdbonly /optimize+ /out:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll /doc:$(OUTDIR)\OSGeo.MapGuide.Foundation.xml /platform:$(PLATFORM) /target:library .\*.cs

Modified: sandbox/jng/swig-java/Web/src/DotNetApi/Geometry/GeometryMakefile
===================================================================
--- sandbox/jng/swig-java/Web/src/DotNetApi/Geometry/GeometryMakefile	2012-11-26 14:27:27 UTC (rev 7227)
+++ sandbox/jng/swig-java/Web/src/DotNetApi/Geometry/GeometryMakefile	2012-11-26 16:00:07 UTC (rev 7228)
@@ -12,8 +12,8 @@
 release: $(OUTDIR)\OSGeo.MapGuide.Geometry.dll
 
 $(OUTDIR)\OSGeo.MapGuide.Geometry.Temp.dll:
-  csc.exe /debug+ /debug:full /optimize- /out:$(OUTDIR)\OSGeo.MapGuide.Geometry.dll /platform:$(PLATFORM) /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll /target:library .\*.cs
+  csc.exe /debug+ /debug:full /optimize- /out:$(OUTDIR)\OSGeo.MapGuide.Geometry.dll /doc:$(OUTDIR)\OSGeo.MapGuide.Geometry.xml /platform:$(PLATFORM) /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll /target:library .\*.cs
   copy /y $(OUTDIR)\OSGeo.MapGuide.Geometry.dll $(OUTDIR)\OSGeo.MapGuide.Geometry.Temp.dll
 
 $(OUTDIR)\OSGeo.MapGuide.Geometry.dll:
-  csc.exe /debug+ /debug:pdbonly /optimize+ /out:$(OUTDIR)\OSGeo.MapGuide.Geometry.dll /platform:$(PLATFORM) /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll /target:library .\*.cs
+  csc.exe /debug+ /debug:pdbonly /optimize+ /out:$(OUTDIR)\OSGeo.MapGuide.Geometry.dll /doc:$(OUTDIR)\OSGeo.MapGuide.Geometry.xml /platform:$(PLATFORM) /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll /target:library .\*.cs

Modified: sandbox/jng/swig-java/Web/src/DotNetApi/MapGuideCommon/MapGuideCommonMakefile
===================================================================
--- sandbox/jng/swig-java/Web/src/DotNetApi/MapGuideCommon/MapGuideCommonMakefile	2012-11-26 14:27:27 UTC (rev 7227)
+++ sandbox/jng/swig-java/Web/src/DotNetApi/MapGuideCommon/MapGuideCommonMakefile	2012-11-26 16:00:07 UTC (rev 7228)
@@ -12,8 +12,8 @@
 release: $(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.dll
 
 $(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.Temp.dll:
-  csc.exe /debug+ /debug:full /optimize- /out:$(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.dll /platform:$(PLATFORM) /target:library /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll;$(OUTDIR)\OSGeo.MapGuide.Geometry.dll;$(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll .\*.cs
+  csc.exe /debug+ /debug:full /optimize- /out:$(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.dll /doc:$(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.xml /platform:$(PLATFORM) /target:library /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll;$(OUTDIR)\OSGeo.MapGuide.Geometry.dll;$(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll .\*.cs
   copy /y $(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.dll $(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.Temp.dll
 
 $(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.dll:
-  csc.exe /debug+ /debug:pdbonly /optimize+ /out:$(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.dll /target:library /platform:$(PLATFORM) /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll;$(OUTDIR)\OSGeo.MapGuide.Geometry.dll;$(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll .\*.cs
+  csc.exe /debug+ /debug:pdbonly /optimize+ /out:$(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.dll /doc:$(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.xml /target:library /platform:$(PLATFORM) /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll;$(OUTDIR)\OSGeo.MapGuide.Geometry.dll;$(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll .\*.cs

Modified: sandbox/jng/swig-java/Web/src/DotNetApi/PlatformBase/PlatformBaseMakefile
===================================================================
--- sandbox/jng/swig-java/Web/src/DotNetApi/PlatformBase/PlatformBaseMakefile	2012-11-26 14:27:27 UTC (rev 7227)
+++ sandbox/jng/swig-java/Web/src/DotNetApi/PlatformBase/PlatformBaseMakefile	2012-11-26 16:00:07 UTC (rev 7228)
@@ -12,8 +12,8 @@
 release: $(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll
 
 $(OUTDIR)\OSGeo.MapGuide.PlatformBase.Temp.dll:
-  csc.exe /debug+ /debug:full /optimize- /out:$(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll /platform:$(PLATFORM) /target:library /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll;$(OUTDIR)\OSGeo.MapGuide.Geometry.dll .\*.cs
+  csc.exe /debug+ /debug:full /optimize- /out:$(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll /doc:$(OUTDIR)\OSGeo.MapGuide.PlatformBase.xml /platform:$(PLATFORM) /target:library /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll;$(OUTDIR)\OSGeo.MapGuide.Geometry.dll .\*.cs
   copy /y $(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll $(OUTDIR)\OSGeo.MapGuide.PlatformBase.Temp.dll
 
 $(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll:
-  csc.exe /debug+ /debug:pdbonly /optimize+ /out:$(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll /platform:$(PLATFORM) /target:library /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll;$(OUTDIR)\OSGeo.MapGuide.Geometry.dll .\*.cs
+  csc.exe /debug+ /debug:pdbonly /optimize+ /out:$(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll /doc:$(OUTDIR)\OSGeo.MapGuide.PlatformBase.xml /platform:$(PLATFORM) /target:library /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll;$(OUTDIR)\OSGeo.MapGuide.Geometry.dll .\*.cs

Modified: sandbox/jng/swig-java/Web/src/DotNetApi/Web/WebMakefile
===================================================================
--- sandbox/jng/swig-java/Web/src/DotNetApi/Web/WebMakefile	2012-11-26 14:27:27 UTC (rev 7227)
+++ sandbox/jng/swig-java/Web/src/DotNetApi/Web/WebMakefile	2012-11-26 16:00:07 UTC (rev 7228)
@@ -12,8 +12,8 @@
 release: $(OUTDIR)\OSGeo.MapGuide.Web.dll
 
 $(OUTDIR)\OSGeo.MapGuide.Web.Temp.dll:
-  csc.exe /debug+ /debug:full /optimize- /out:$(OUTDIR)\OSGeo.MapGuide.Web.dll /platform:$(PLATFORM) /target:library /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll;$(OUTDIR)\OSGeo.MapGuide.Geometry.dll;$(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll;$(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.dll .\*.cs
+  csc.exe /debug+ /debug:full /optimize- /out:$(OUTDIR)\OSGeo.MapGuide.Web.dll /doc:$(OUTDIR)\OSGeo.MapGuide.Web.xml /platform:$(PLATFORM) /target:library /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll;$(OUTDIR)\OSGeo.MapGuide.Geometry.dll;$(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll;$(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.dll .\*.cs
   copy /y $(OUTDIR)\OSGeo.MapGuide.Web.dll $(OUTDIR)\OSGeo.MapGuide.Web.Temp.dll
 
 $(OUTDIR)\OSGeo.MapGuide.Web.dll:
-  csc.exe /debug+ /debug:pdbonly /optimize+ /out:$(OUTDIR)\OSGeo.MapGuide.Web.dll /platform:$(PLATFORM) /target:library /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll;$(OUTDIR)\OSGeo.MapGuide.Geometry.dll;$(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll;$(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.dll .\*.cs
+  csc.exe /debug+ /debug:pdbonly /optimize+ /out:$(OUTDIR)\OSGeo.MapGuide.Web.dll /doc:$(OUTDIR)\OSGeo.MapGuide.Web.xml /platform:$(PLATFORM) /target:library /reference:$(OUTDIR)\OSGeo.MapGuide.Foundation.dll;$(OUTDIR)\OSGeo.MapGuide.Geometry.dll;$(OUTDIR)\OSGeo.MapGuide.PlatformBase.dll;$(OUTDIR)\OSGeo.MapGuide.MapGuideCommon.dll .\*.cs

Modified: sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/Foundation/FoundationApiGen.xml
===================================================================
--- sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/Foundation/FoundationApiGen.xml	2012-11-26 14:27:27 UTC (rev 7227)
+++ sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/Foundation/FoundationApiGen.xml	2012-11-26 16:00:07 UTC (rev 7228)
@@ -48,6 +48,7 @@
    Swig inline section.
 -->
 <SwigInline>
+  %include "FoundationApi_Doc.i" //doc fragments
   %include "language.i"   //typemaps specific for each language
   %include "../../../../Common/Foundation/System/FoundationClassId.h"
 

Modified: sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/Geometry/GeometryApiGen.xml
===================================================================
--- sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/Geometry/GeometryApiGen.xml	2012-11-26 14:27:27 UTC (rev 7227)
+++ sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/Geometry/GeometryApiGen.xml	2012-11-26 16:00:07 UTC (rev 7228)
@@ -50,6 +50,7 @@
 -->
 <SwigInline>
   %import "../Foundation/FoundationApi.i"
+  %include "GeometryApi_Doc.i" //doc fragments
   %include "language.i"   //typemaps specific for each language
   %include "../../../../Common/Geometry/GeometryClassId.h"
 

Modified: sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/MapGuideCommon/MapGuideCommonApiGen.xml
===================================================================
--- sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/MapGuideCommon/MapGuideCommonApiGen.xml	2012-11-26 14:27:27 UTC (rev 7227)
+++ sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/MapGuideCommon/MapGuideCommonApiGen.xml	2012-11-26 16:00:07 UTC (rev 7228)
@@ -53,6 +53,7 @@
   %import "../Foundation/FoundationApi.i"
   %import "../Geometry/GeometryApi.i"
   %import "../PlatformBase/PlatformBaseApi.i"
+  %include "MapGuideCommonApi_Doc.i" //doc fragments
   %include "language.i"   //typemaps specific for each language
   %include "../../../../Common/MapGuideCommon/System/MapGuideCommonClassId.h"
 

Modified: sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/PlatformBase/PlatformBaseApiGen.xml
===================================================================
--- sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/PlatformBase/PlatformBaseApiGen.xml	2012-11-26 14:27:27 UTC (rev 7227)
+++ sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/PlatformBase/PlatformBaseApiGen.xml	2012-11-26 16:00:07 UTC (rev 7228)
@@ -52,6 +52,7 @@
 <SwigInline>
   %import "../Foundation/FoundationApi.i"
   %import "../Geometry/GeometryApi.i"
+  %include "PlatformBaseApi_Doc.i" //doc fragments
   %include "language.i"   //typemaps specific for each language
   %include "../../../../Common/PlatformBase/Services/PlatformBaseClassId.h"
 

Modified: sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/Web/WebApiGen.xml
===================================================================
--- sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/Web/WebApiGen.xml	2012-11-26 14:27:27 UTC (rev 7227)
+++ sandbox/jng/swig-java/Web/src/DotNetUnmanagedApi/Web/WebApiGen.xml	2012-11-26 16:00:07 UTC (rev 7228)
@@ -14,7 +14,7 @@
    Target section.
 -->
 <Target path="./MapGuideApi.i" />
-<DocTarget path="./MapGuideApi_Doc.i" />
+<DocTarget path="./WebApi_Doc.i" />
 
 <!--
    C++ inline section.
@@ -62,6 +62,7 @@
   %import "../Geometry/GeometryApi.i"
   %import "../PlatformBase/PlatformBaseApi.i"
   %import "../MapGuideCommon/MapGuideCommonApi.i"
+  %include "WebApi_Doc.i" //doc fragments
   %include "language.i"   //typemaps specific for each language
   %include "InitializeWebTier.i"
   %include "../../WebApp/WebAppClassId.h"

Modified: sandbox/jng/swig-java/Web/src/JavaApiEx/getclassid.code
===================================================================
--- sandbox/jng/swig-java/Web/src/JavaApiEx/getclassid.code	2012-11-26 14:27:27 UTC (rev 7227)
+++ sandbox/jng/swig-java/Web/src/JavaApiEx/getclassid.code	2012-11-26 16:00:07 UTC (rev 7228)
@@ -1,6 +1,6 @@
 
 /* Get a class identifier from an Object instance */
-JNIEXPORT jint JNICALL Java_org_osgeo_mapguide_MapGuideJavaApiJNI_getClassId(JNIEnv* jenv, jclass jcls, jlong jarg1)
+JNIEXPORT jint JNICALL Java_org_osgeo_mapguide_MapGuideJavaApiExJNI_getClassId(JNIEnv* jenv, jclass jcls, jlong jarg1)
 {
   return ((MgObject*)(void*)jarg1)->GetClassId();
 }

Modified: sandbox/jng/swig-java/Web/src/JavaApiEx/javaextensions.i
===================================================================
--- sandbox/jng/swig-java/Web/src/JavaApiEx/javaextensions.i	2012-11-26 14:27:27 UTC (rev 7227)
+++ sandbox/jng/swig-java/Web/src/JavaApiEx/javaextensions.i	2012-11-26 16:00:07 UTC (rev 7228)
@@ -45,10 +45,37 @@
 %rename(addItem) MgBatchPropertyCollection::Add;
 %rename(addItem) MgClassDefinitionCollection::Add;
 %rename(addItem) MgFeatureSchemaCollection::Add;
+%rename(addItem) MgPropertyDefinitionCollection::Add;
 %rename(addItem) MgIntCollection::Add;
 %rename(addItem) MgPropertyCollection::Add;
 %rename(addItem) MgStringCollection::Add;
+%rename(addItem) MgLayerCollection::Add;
+%rename(addItem) MgLayerGroupCollection::Add;
 
+//This is a helper macro to implement the required APIs for collection items
+//
+//This could possibly apply to all proxy classes, but for now we're only interested in classes
+//that are part of any collection class that implements java.util.Collection. This is needed for
+//contains() and other container tests for equality to work
+//
+//Implementation borrowed from OGR swig java bindings
+%define IMPLEMENT_MG_ITEM_API(item_type)
+
+%typemap(javacode) item_type %{
+    public boolean equals(Object obj) {
+        boolean equal=false;
+        if(obj instanceof $javaclassname)
+            equal=((($javaclassname)obj).swigCPtr==this.swigCPtr);
+        return equal;
+    }
+    
+    public int hashCode() {
+        return (int)swigCPtr;
+    }
+%}
+
+%enddef
+
 //This is a helper macro to implement the bulk of the java.util.Collection interface for any proxy class
 //that needs one
 //
@@ -86,7 +113,7 @@
          * Returns true if the iteration has more elements
          */
         public boolean hasNext() {
-            return _pos + 1 <= _count;
+            return _pos + 1 < _count;
         }
         
         /**
@@ -229,7 +256,11 @@
             }
             return a;
         } else {
-            return (item_type[])items;
+            item_type[] retVal = (item_type[])java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), items.length);
+            for (int i = 0; i < retVal.length; i++) {
+                retVal[i] = (item_type)items[i];
+            }
+            return retVal;
         }
     }
 
@@ -266,7 +297,7 @@
          * Returns true if the iteration has more elements
          */
         public boolean hasNext() {
-            return _pos + 1 <= _count;
+            return _pos + 1 < _count;
         }
         
         /**
@@ -295,10 +326,20 @@
 %}
 %enddef
 
-//Plug the stock implementation for our MapGuide collection classes
-IMPLEMENT_MG_JAVA_COLLECTION_API(MgBatchPropertyCollection, MgPropertyCollection)
+//Plug the stock implementation for our MapGuide collection and item classes
+IMPLEMENT_MG_ITEM_API(MgClassDefinition)
+IMPLEMENT_MG_ITEM_API(MgFeatureSchema)
+IMPLEMENT_MG_ITEM_API(MgPropertyDefinition)
+IMPLEMENT_MG_ITEM_API(MgProperty)
+IMPLEMENT_MG_ITEM_API(MgLayerBase)
+IMPLEMENT_MG_ITEM_API(MgLayerGroup)
+
+//IMPLEMENT_MG_JAVA_COLLECTION_API(MgBatchPropertyCollection, MgPropertyCollection)
 IMPLEMENT_MG_JAVA_COLLECTION_API(MgClassDefinitionCollection, MgClassDefinition)
 IMPLEMENT_MG_JAVA_COLLECTION_API(MgFeatureSchemaCollection, MgFeatureSchema)
+IMPLEMENT_MG_JAVA_COLLECTION_API(MgPropertyDefinitionCollection, MgPropertyDefinition)
 IMPLEMENT_MG_JAVA_COLLECTION_API(MgPropertyCollection, MgProperty)
 IMPLEMENT_MG_JAVA_COLLECTION_API(MgStringCollection, String)
+IMPLEMENT_MG_JAVA_COLLECTION_API(MgLayerCollection, MgLayerBase)
+IMPLEMENT_MG_JAVA_COLLECTION_API(MgLayerGroupCollection, MgLayerGroup)
 IMPLEMENT_MG_JAVA_ITERABLE_API(MgReadOnlyLayerCollection, MgLayerBase)
\ No newline at end of file



More information about the mapguide-commits mailing list