[mapguide-commits] r5148 - in trunk/MgDev: Common/MdfModel Common/MdfParser Common/Schema Server/src/Services/Rendering

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Sep 17 18:23:54 EDT 2010


Author: waltweltonlair
Date: 2010-09-17 22:23:54 +0000 (Fri, 17 Sep 2010)
New Revision: 5148

Modified:
   trunk/MgDev/Common/MdfModel/LengthConverter.h
   trunk/MgDev/Common/MdfModel/TileWatermarkPosition.cpp
   trunk/MgDev/Common/MdfModel/TileWatermarkPosition.h
   trunk/MgDev/Common/MdfModel/WatermarkAppearance.cpp
   trunk/MgDev/Common/MdfModel/WatermarkAppearance.h
   trunk/MgDev/Common/MdfModel/WatermarkDefinition.cpp
   trunk/MgDev/Common/MdfModel/WatermarkDefinition.h
   trunk/MgDev/Common/MdfModel/WatermarkInstance.cpp
   trunk/MgDev/Common/MdfModel/WatermarkInstance.h
   trunk/MgDev/Common/MdfModel/WatermarkOffsetUnit.h
   trunk/MgDev/Common/MdfModel/WatermarkPosition.cpp
   trunk/MgDev/Common/MdfModel/WatermarkPosition.h
   trunk/MgDev/Common/MdfModel/WatermarkXOffset.cpp
   trunk/MgDev/Common/MdfModel/WatermarkXOffset.h
   trunk/MgDev/Common/MdfModel/WatermarkYOffset.cpp
   trunk/MgDev/Common/MdfModel/WatermarkYOffset.h
   trunk/MgDev/Common/MdfModel/XYWatermarkPosition.cpp
   trunk/MgDev/Common/MdfModel/XYWatermarkPosition.h
   trunk/MgDev/Common/MdfParser/IOWatermarkInstance.cpp
   trunk/MgDev/Common/MdfParser/IOWatermarkXOffset.cpp
   trunk/MgDev/Common/MdfParser/IOWatermarkYOffset.cpp
   trunk/MgDev/Common/Schema/WatermarkDefinition-1.0.0.xsd
   trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
Log:
More watermark cleanup - MdfModel

* Numerous member variables were not being initialized in constructors - BAD!!
* In MdfModel, member variables should be initialized to the corresponding default property value specified in the schema!
* Never include files before stdafx.h.  If precompiled headers is enabled then headers included before stdafx.h are ignored.
* Renamed some class properties to be consistent with the schema.  E.g. WatermarkXOffset had a Length property but in the schema it's called Offset.  Now the code also uses Offset.
* Renamed WatermarkResourceID proeprty on WatermarkInstance to just ResourceId.
* New source files should have copyrights that only reference the current year.
* Adjusted formatting to match the rest of the project.

Also cleaned up some documentation in the schema.


Modified: trunk/MgDev/Common/MdfModel/LengthConverter.h
===================================================================
--- trunk/MgDev/Common/MdfModel/LengthConverter.h	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/LengthConverter.h	2010-09-17 22:23:54 UTC (rev 5148)
@@ -33,7 +33,7 @@
         Feet,
         Yards,
         Miles,
-        Points,
+        Points
     };
 
     class MDFMODEL_API LengthConverter

Modified: trunk/MgDev/Common/MdfModel/TileWatermarkPosition.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/TileWatermarkPosition.cpp	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/TileWatermarkPosition.cpp	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -34,8 +34,11 @@
 // PURPOSE: Construct and initialize an instance of the TileWatermarkPosition class.
 //-------------------------------------------------------------------------
 TileWatermarkPosition::TileWatermarkPosition()
-    :m_horizontalPosition(NULL), m_verticalPosition(NULL)
 {
+    this->m_tileWidth = 150.0;
+    this->m_tileHeight = 150.0;
+    this->m_horizontalPosition = NULL;
+    this->m_verticalPosition = NULL;
 }
 
 //-------------------------------------------------------------------------
@@ -79,7 +82,6 @@
     this->m_tileHeight = dTileHeight;
 }
 
-
 //-------------------------------------------------------------------------
 // PURPOSE: Accessor method for the HorizontalPosition property.
 //          The WatermarkXOffset is the type of offset used in the position of watermark.
@@ -108,7 +110,7 @@
 //          pXPosition - Adopted WatermarkXOffset object that is created on the heap.
 //                             It may be NULL.
 //-------------------------------------------------------------------------
-void TileWatermarkPosition::AdoptHorizontalPosition(WatermarkXOffset *pHorizontalPosition)
+void TileWatermarkPosition::AdoptHorizontalPosition(WatermarkXOffset* pHorizontalPosition)
 {
     if (this->m_horizontalPosition != pHorizontalPosition)
     {
@@ -157,7 +159,7 @@
 //          pYPosition - Adopted WatermarkYOffset object that is created on the heap.
 //                             It may be NULL.
 //-------------------------------------------------------------------------
-void TileWatermarkPosition::AdoptVerticalPosition(WatermarkYOffset *pVerticalPosition)
+void TileWatermarkPosition::AdoptVerticalPosition(WatermarkYOffset* pVerticalPosition)
 {
     if (this->m_verticalPosition != pVerticalPosition)
     {
@@ -179,33 +181,40 @@
 }
 
 //-------------------------------------------------------------------------
-// Whether this position is the same as given one
+// Determines whether this position is the same as the supplied one.
 //-------------------------------------------------------------------------
 bool TileWatermarkPosition::Equals(WatermarkPosition* another)
 {
     TileWatermarkPosition* anotherPosition = dynamic_cast<TileWatermarkPosition*>(another);
-    if(!anotherPosition) return false;
+    if (!anotherPosition)
+        return false;
 
-    if(fabs(this->m_tileWidth - anotherPosition->m_tileWidth) > doubleTolerance)
+    // check width / height
+    if (fabs(this->m_tileWidth - anotherPosition->m_tileWidth) > doubleTolerance)
         return false;
-    if(fabs(this->m_tileHeight - anotherPosition->m_tileHeight) > doubleTolerance)
+    if (fabs(this->m_tileHeight - anotherPosition->m_tileHeight) > doubleTolerance)
         return false;
     
-    if(!this->m_horizontalPosition)
+    // check horizontal position
+    if (!this->m_horizontalPosition)
     {
-        if(anotherPosition->m_horizontalPosition) return false;
+        if (anotherPosition->m_horizontalPosition)
+            return false;
     }
-    else if(!this->m_horizontalPosition->Equals(anotherPosition->m_horizontalPosition))
+    else if (!this->m_horizontalPosition->Equals(anotherPosition->m_horizontalPosition))
         return false;
 
-    if(!this->m_verticalPosition)
+    // check vertical position
+    if (!this->m_verticalPosition)
     {
-        return !anotherPosition->m_verticalPosition;
+        if (anotherPosition->m_verticalPosition)
+            return false;
     }
-    else
-    {
-        return this->m_verticalPosition->Equals(anotherPosition->m_verticalPosition);
-    }
+    else if (!this->m_verticalPosition->Equals(anotherPosition->m_verticalPosition))
+        return false;
+
+    // all checks passed
+    return true;
 }
 
 #ifdef _WIN32

Modified: trunk/MgDev/Common/MdfModel/TileWatermarkPosition.h
===================================================================
--- trunk/MgDev/Common/MdfModel/TileWatermarkPosition.h	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/TileWatermarkPosition.h	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -28,10 +28,10 @@
     //-------------------------------------------------------------------------
     // DESCRIPTION:
     // The TileWatermarkPosition class is one concrete implementation of WatermarkPosition.
-    // It will repeat the source both in X and Y dimension. Tile is the unit of repeat.
+    // It will repeat the source both in X and Y dimension.  Tile is the unit of repeat.
     // Within tile it uses X-Y as the position of watermark.
     //------------------------------------------------------------------------
-class MDFMODEL_API TileWatermarkPosition: public WatermarkPosition
+    class MDFMODEL_API TileWatermarkPosition: public WatermarkPosition
     {
     public:
         // Construction, destruction, initialization.
@@ -51,13 +51,13 @@
         // Property: HorizontalPosition
         const WatermarkXOffset* GetHorizontalPosition() const;
         WatermarkXOffset* GetHorizontalPosition();
-        void AdoptHorizontalPosition(WatermarkXOffset *pHorizontalPosition);
+        void AdoptHorizontalPosition(WatermarkXOffset* pHorizontalPosition);
         WatermarkXOffset* OrphanHorizontalPosition();
         
         // Property: VerticalPosition
         const WatermarkYOffset* GetVerticalPosition() const;
         WatermarkYOffset* GetVerticalPosition();
-        void AdoptVerticalPosition(WatermarkYOffset *pVerticalPosition);
+        void AdoptVerticalPosition(WatermarkYOffset* pVerticalPosition);
         WatermarkYOffset* OrphanVerticalPosition();
 
         virtual bool Equals(WatermarkPosition* another);
@@ -71,15 +71,15 @@
 
     private:
         // Hidden TileWatermarkPosition copy constructor and assignment operator.
-         TileWatermarkPosition(const TileWatermarkPosition&);
-         TileWatermarkPosition& operator=(const TileWatermarkPosition&);
+        TileWatermarkPosition(const TileWatermarkPosition&);
+        TileWatermarkPosition& operator=(const TileWatermarkPosition&);
 
         // Data members
         // See corresponding properties for descriptions
-         double m_tileWidth;
-         double m_tileHeight;
-         WatermarkXOffset* m_horizontalPosition;
-         WatermarkYOffset* m_verticalPosition;
+        double m_tileWidth;
+        double m_tileHeight;
+        WatermarkXOffset* m_horizontalPosition;
+        WatermarkYOffset* m_verticalPosition;
 
         static const double doubleTolerance;
     };

Modified: trunk/MgDev/Common/MdfModel/WatermarkAppearance.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/WatermarkAppearance.cpp	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/WatermarkAppearance.cpp	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -21,8 +21,8 @@
 // WatermarkAppearance class is to define the appearance of watermark.
 //-------------------------------------------------------------------------
 
+#include "stdafx.h"
 #include <cmath>
-#include "stdafx.h"
 #include "WatermarkAppearance.h"
 
 using namespace MDFMODEL_NAMESPACE;
@@ -34,6 +34,8 @@
 //-------------------------------------------------------------------------
 WatermarkAppearance::WatermarkAppearance()
 {
+    this->m_transparency = 0.0;
+    this->m_rotation = 0.0;
 }
 
 //-------------------------------------------------------------------------
@@ -44,8 +46,8 @@
 }
 
 //-------------------------------------------------------------------------
-// Returns the transparency (0 - 100). O means totally opaque. 100 means totally
-// transparent. 
+// Returns the transparency (0 - 100).  Zero means fully opaque, and 100
+// means fully transparent. 
 //-------------------------------------------------------------------------
 double WatermarkAppearance::GetTransparency() const
 {
@@ -53,18 +55,23 @@
 }
 
 //-------------------------------------------------------------------------
-// Set the transparency (0 - 100). O means totally opaque. 100 means totally
-// transparent. If the parameter is more than 100, treat it as 100. If the
-// parameter is less than 0, treat it as 0.
+// Set the transparency (0 - 100).  Zero means fully opaque, and 100
+// means fully transparent.  If the parameter is more than 100, treat it
+// as 100.  If the parameter is less than 0, treat it as 0.
 //-------------------------------------------------------------------------
 void WatermarkAppearance::SetTransparency(const double& dTransparency)
 {
-    this->m_transparency = (dTransparency > 100) ? 100 : (dTransparency < 0 ? 0 : dTransparency);
+    if (dTransparency > 100.0)
+        this->m_transparency = 100.0;
+    else if (dTransparency < 0.0)
+        this->m_transparency = 0.0;
+    else
+        this->m_transparency = dTransparency;
 }
 
 //-------------------------------------------------------------------------
-// Returns the rotation (0 - 360). O means no rotation. 90 means rotating 90 degree
-// anticlockwise. 360 should be the same as 0 as it turns a whole circle.
+// Returns the rotation (0 - 360).  Zero means no rotation, while 90 means
+// rotating 90 degrees anticlockwise.
 //-------------------------------------------------------------------------
 double WatermarkAppearance::GetRotation() const
 {
@@ -72,21 +79,28 @@
 }
 
 //-------------------------------------------------------------------------
-// Set the rotation (0 - 360). O means no rotation. 90 means rotating 90 degree
-// anticlockwise. 360 should be the same as 0 as it turns a whole circle. 
-// If the parameter is more than 360, treat it as 360. If the
-// parameter is less than 0, treat it as 0.
+// Set the rotation (0 - 360).  Zero means no rotation, while 90 means
+// rotating 90 degrees anticlockwise.  If the parameter is more than 360,
+// treat it as 360.  If the parameter is less than 0, treat it as 0.
 //-------------------------------------------------------------------------
 void WatermarkAppearance::SetRotation(const double& dRotation)
 {
-    this->m_rotation = (dRotation > 360) ? 360 : (dRotation < 0 ? 0 : dRotation);
+    if (dRotation > 360.0)
+        this->m_rotation = 360.0;
+    else if (dRotation < 0.0)
+        this->m_rotation = 0.0;
+    else
+        this->m_rotation = dRotation;
 }
 
+//-------------------------------------------------------------------------
+// Determines whether this appearance is the same as the supplied one.
+//-------------------------------------------------------------------------
 bool WatermarkAppearance::Equals(WatermarkAppearance* another)
 {
-    return another
-            && fabs(this->m_transparency - another->m_transparency) < doubleTolerance
-            && fabs(this->m_rotation - another->m_rotation) < doubleTolerance;
+    return another &&
+           fabs(this->m_transparency - another->m_transparency) < doubleTolerance &&
+           fabs(this->m_rotation - another->m_rotation) < doubleTolerance;
 }
 
 #ifdef _WIN32

Modified: trunk/MgDev/Common/MdfModel/WatermarkAppearance.h
===================================================================
--- trunk/MgDev/Common/MdfModel/WatermarkAppearance.h	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/WatermarkAppearance.h	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -26,7 +26,7 @@
     // DESCRIPTION:
     // The WatermarkAppearance class is to define the appearance of watermark.
     //------------------------------------------------------------------------
-class MDFMODEL_API WatermarkAppearance
+    class MDFMODEL_API WatermarkAppearance
     {
     public:
         // Construction, destruction, initialization.
@@ -53,8 +53,8 @@
 
     private:
         // Hidden WatermarkAppearance copy constructor and assignment operator.
-         WatermarkAppearance(const WatermarkAppearance&);
-         WatermarkAppearance& operator=(const WatermarkAppearance&);
+        WatermarkAppearance(const WatermarkAppearance&);
+        WatermarkAppearance& operator=(const WatermarkAppearance&);
 
         // Data members
         // See corresponding properties for descriptions

Modified: trunk/MgDev/Common/MdfModel/WatermarkDefinition.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/WatermarkDefinition.cpp	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/WatermarkDefinition.cpp	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -18,15 +18,19 @@
 //-------------------------------------------------------------------------
 // DESCRIPTION:
 // The WatermarkDefinition class implementation.
-// All the data objects in the WatermarkDefinition (Content, Appearance, Position etc) 
-// are accessible. While unfettered access to all the stored objects in provided, 
-// these data are still owned by the WatermarkDefinition object.
-// Methods that have a prefix of "Adopt", imply that the object passed to them
-// has to be created on the heap and the WaterDefinition object is now responsible 
-// for its deletion. Methods that have a prefix of "Orphan" imply that the pointer
-// returned, points to an object on the heap and its is the caller who is responsible
-// for its deletion. Methods that have a "Get" prefix simply give access without
-// a change of ownership.
+//
+// All the data objects in the WatermarkDefinition (Source, Appearance,
+// Position, etc.) are accessible.  While unfettered access to all the stored
+// objects is provided, these data are still owned by the WatermarkDefinition
+// object.
+//   * Methods that have a prefix of "Adopt" imply that the object passed
+//     to them has to be created on the heap and the WaterDefinition object
+//     is now responsible for their deletion.
+//   * Methods that have a prefix of "Orphan" imply that the returned pointer
+//     points to an object on the heap and it's the caller's responsibility
+//     to delete it.
+//   * Methods that have a "Get" prefix simply give access without a change
+//     of ownership.
 //-------------------------------------------------------------------------
 
 #include "stdafx.h"
@@ -38,8 +42,10 @@
 // PURPOSE: Construct and initialize an instance of the WatermarkDefinition class.
 //-------------------------------------------------------------------------
 WatermarkDefinition::WatermarkDefinition()
-    :m_source(NULL), m_appearance(NULL), m_position(NULL)
 {
+    this->m_source = NULL;
+    this->m_appearance = NULL;
+    this->m_position = NULL;
 }
 
 //-------------------------------------------------------------------------
@@ -49,9 +55,9 @@
 {
     delete this->m_source;
     delete this->m_appearance;
+    delete this->m_position;
 }
 
-
 //-------------------------------------------------------------------------
 // PURPOSE: Accessor method for the source property.
 //          The SymbolDefinition is the type of source content used in watermark.
@@ -80,7 +86,7 @@
 //          pSource - Adopted SymbolDefinition object that is created on the heap.
 //                             It may be NULL.
 //-------------------------------------------------------------------------
-void WatermarkDefinition::AdoptSource(SymbolDefinition *pSource)
+void WatermarkDefinition::AdoptSource(SymbolDefinition* pSource)
 {
     if (this->m_source != pSource)
     {
@@ -129,7 +135,7 @@
 //          pAppearance - Adopted WatermarkAppearance object that is created on the heap.
 //                             It may be NULL.
 //-------------------------------------------------------------------------
-void WatermarkDefinition::AdoptAppearance(WatermarkAppearance *pAppearance)
+void WatermarkDefinition::AdoptAppearance(WatermarkAppearance* pAppearance)
 {
     if (this->m_appearance != pAppearance)
     {
@@ -178,7 +184,7 @@
 //          pPosition - Adopted WatermarkPosition object that is created on the heap.
 //                             It may be NULL.
 //-------------------------------------------------------------------------
-void WatermarkDefinition::AdoptPosition(WatermarkPosition *pPosition)
+void WatermarkDefinition::AdoptPosition(WatermarkPosition* pPosition)
 {
     if (this->m_position != pPosition)
     {

Modified: trunk/MgDev/Common/MdfModel/WatermarkDefinition.h
===================================================================
--- trunk/MgDev/Common/MdfModel/WatermarkDefinition.h	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/WatermarkDefinition.h	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -31,7 +31,7 @@
     // The WatermarkDefinition class is the root document node of the MdfModel. Through its
     // interface, one can get access to all the data in the WatermarkDefinition.
     //------------------------------------------------------------------------
-class MDFMODEL_API WatermarkDefinition: public MdfRootObject
+    class MDFMODEL_API WatermarkDefinition: public MdfRootObject
     {
     public:
         // Construction, destruction, initialization.
@@ -43,19 +43,19 @@
         // Property: Source
         const SymbolDefinition* GetSource() const;
         SymbolDefinition* GetSource();
-        void AdoptSource(SymbolDefinition *pSource);
+        void AdoptSource(SymbolDefinition* pSource);
         SymbolDefinition* OrphanSource();
         
         // Property: Appearance
         const WatermarkAppearance* GetAppearance() const;
         WatermarkAppearance* GetAppearance();
-        void AdoptAppearance(WatermarkAppearance *pAppearance);
+        void AdoptAppearance(WatermarkAppearance* pAppearance);
         WatermarkAppearance* OrphanAppearance();
         
         // Property: Position
         const WatermarkPosition* GetPosition() const;
         WatermarkPosition* GetPosition();
-        void AdoptPosition(WatermarkPosition *pPosition);
+        void AdoptPosition(WatermarkPosition* pPosition);
         WatermarkPosition* OrphanPosition();
 
 //#ifdef _WIN32
@@ -67,14 +67,14 @@
 
     private:
         // Hidden WatermarkDefinition copy constructor and assignment operator.
-         WatermarkDefinition(const WatermarkDefinition&);
-         WatermarkDefinition& operator=(const WatermarkDefinition&);
+        WatermarkDefinition(const WatermarkDefinition&);
+        WatermarkDefinition& operator=(const WatermarkDefinition&);
 
         // Data members
         // See corresponding properties for descriptions
-         SymbolDefinition* m_source;
-         WatermarkAppearance* m_appearance;
-         WatermarkPosition* m_position;
+        SymbolDefinition* m_source;
+        WatermarkAppearance* m_appearance;
+        WatermarkPosition* m_position;
     };
 
 END_NAMESPACE_MDFMODEL

Modified: trunk/MgDev/Common/MdfModel/WatermarkInstance.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/WatermarkInstance.cpp	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/WatermarkInstance.cpp	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -30,16 +30,16 @@
 // PARAMETERS:
 //     Input:
 //          strName - the unique WatermarkInstance name. Cannot be an empty string.
-//          strWatermarkResourceID - the resource ID for the watermark definition.
+//          strResourceId - the resource ID for the watermark definition.
 //-------------------------------------------------------------------------
-WatermarkInstance::WatermarkInstance(const MdfString& strName, const MdfString& strWatermarkResourceID)
-: m_strName(strName)
-, m_strWatermarkResourceID(strWatermarkResourceID)
-, m_usage(ALL)
-, m_pWatermarkDefinition(NULL)
-, m_appearanceOverride(NULL)
-, m_positionOverride(NULL)
+WatermarkInstance::WatermarkInstance(const MdfString& strName, const MdfString& strResourceId)
 {
+    this->m_strName = strName;
+    this->m_strResourceId = strResourceId;
+    this->m_usage = All;
+    this->m_appearanceOverride = NULL;
+    this->m_positionOverride = NULL;
+    this->m_pWatermarkDefinition = NULL;
 }
 
 //-------------------------------------------------------------------------
@@ -47,9 +47,9 @@
 //-------------------------------------------------------------------------
 WatermarkInstance::~WatermarkInstance()
 {
-    delete this->m_pWatermarkDefinition;
     delete this->m_appearanceOverride;
     delete this->m_positionOverride;
+    delete this->m_pWatermarkDefinition;
 }
 
 //-------------------------------------------------------------------------
@@ -64,33 +64,31 @@
 // PURPOSE: Accessor to the WatermarkInstance name.
 // PARAMETERS:
 //     Input:
-//          strName - unique WatermarkInstance name that is not a blank string.
+//          strName - unique WatermarkInstance name
 //-------------------------------------------------------------------------
 void WatermarkInstance::SetName(const MdfString& strName)
 {
-    if (strName.length() > 0)
-        this->m_strName = strName;
+    this->m_strName = strName;
 }
 
 //-------------------------------------------------------------------------
-// PURPOSE: Accessor for the WatermarkDefinition resourceID that this WatermarkInstance references.
+// PURPOSE: Accessor for the WatermarkDefinition resource ID that this WatermarkInstance references.
 // RETURNS:
 //-------------------------------------------------------------------------
-const MdfString& WatermarkInstance::GetWatermarkResourceID() const
+const MdfString& WatermarkInstance::GetResourceId() const
 {
-    return this->m_strWatermarkResourceID;
+    return this->m_strResourceId;
 }
 
 //-------------------------------------------------------------------------
 // PURPOSE: Accessor to the WatermarkDefinition Uri that this WatermarkInstance references.
 // PARAMETERS:
 //      Input:
-//          strWatermarkResourceID - the watermark resourceID for this WatermarkInstance.Cannot be an empty
+//          strResourceId - the watermark resource ID for this WatermarkInstance
 //-------------------------------------------------------------------------
-void WatermarkInstance::SetWatermarkResourceID(const MdfString& strWatermarkResourceID)
+void WatermarkInstance::SetResourceId(const MdfString& strResourceId)
 {
-    if (strWatermarkResourceID.length() > 0)
-        this->m_strWatermarkResourceID = strWatermarkResourceID;
+    this->m_strResourceId = strResourceId;
 }
 
 //-------------------------------------------------------------------------
@@ -113,55 +111,6 @@
 }
 
 //-------------------------------------------------------------------------
-// PURPOSE: Accessor method for the watermark definition property.
-//          The WatermarkDefinition is the type of watermark definition.
-// RETURNS: The pointer of watermark definition.
-//-------------------------------------------------------------------------
-const WatermarkDefinition* WatermarkInstance::GetWatermarkDefinition() const
-{
-    return this->m_pWatermarkDefinition;
-}
-
-//-------------------------------------------------------------------------
-// PURPOSE: Accessor method for the watermark definition property.
-//          The WatermarkDefinition is the type of watermark definition.
-// RETURNS: The pointer of watermark definition.
-//-------------------------------------------------------------------------
-WatermarkDefinition* WatermarkInstance::GetWatermarkDefinition()
-{
-    return this->m_pWatermarkDefinition;
-}
-
-//-------------------------------------------------------------------------
-// PURPOSE: Accessor method for the watermark definition property.
-//          The WatermarkDefinition is the type of watermark definition.
-// PARAMETERS:
-//        Input:
-//          pWatermarkDefinition - Adopted WatermarkDefinition object that is created on the heap.
-//                             It may be NULL.
-//-------------------------------------------------------------------------
-void WatermarkInstance::AdoptWatermarkDefinition(WatermarkDefinition *pWatermarkDefinition)
-{
-    if (this->m_pWatermarkDefinition != pWatermarkDefinition)
-    {
-        delete this->m_pWatermarkDefinition;
-        this->m_pWatermarkDefinition = pWatermarkDefinition;
-    }
-}
-
-//-------------------------------------------------------------------------
-// PURPOSE: Accessor method for the watermark definition property.
-//          The WatermarkDefinition is the type of watermark definition.
-// RETURNS: The pointer to the orphaned WatermarkDefinition object. It may be NULL.
-//-------------------------------------------------------------------------
-WatermarkDefinition* WatermarkInstance::OrphanWatermarkDefinition()
-{
-    WatermarkDefinition* pRet = this->m_pWatermarkDefinition;
-    this->m_pWatermarkDefinition = NULL;
-    return pRet;
-}
-
-//-------------------------------------------------------------------------
 // PURPOSE: Accessor method for the appearance override property.
 //          The WatermarkAppearance is the type of appearance override in watermark instance.
 // RETURNS: The pointer of watermark appearance override.
@@ -189,7 +138,7 @@
 //          pAppearanceOverride - Adopted WatermarkAppearance object that is created on the heap.
 //                             It may be NULL.
 //-------------------------------------------------------------------------
-void WatermarkInstance::AdoptAppearanceOverride(WatermarkAppearance *pAppearanceOverride)
+void WatermarkInstance::AdoptAppearanceOverride(WatermarkAppearance* pAppearanceOverride)
 {
     if (this->m_appearanceOverride != pAppearanceOverride)
     {
@@ -238,7 +187,7 @@
 //          pPosition - Adopted WatermarkPosition object that is created on the heap.
 //                             It may be NULL.
 //-------------------------------------------------------------------------
-void WatermarkInstance::AdoptPositionOverride(WatermarkPosition *pPositionOverride)
+void WatermarkInstance::AdoptPositionOverride(WatermarkPosition* pPositionOverride)
 {
     if (this->m_positionOverride != pPositionOverride)
     {
@@ -259,27 +208,87 @@
     return pRet;
 }
 
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the watermark definition property.
+//          The WatermarkDefinition is the type of watermark definition.
+// RETURNS: The pointer of watermark definition.
+//-------------------------------------------------------------------------
+const WatermarkDefinition* WatermarkInstance::GetWatermarkDefinition() const
+{
+    return this->m_pWatermarkDefinition;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the watermark definition property.
+//          The WatermarkDefinition is the type of watermark definition.
+// RETURNS: The pointer of watermark definition.
+//-------------------------------------------------------------------------
+WatermarkDefinition* WatermarkInstance::GetWatermarkDefinition()
+{
+    return this->m_pWatermarkDefinition;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the watermark definition property.
+//          The WatermarkDefinition is the type of watermark definition.
+// PARAMETERS:
+//        Input:
+//          pWatermarkDefinition - Adopted WatermarkDefinition object that is created on the heap.
+//                             It may be NULL.
+//-------------------------------------------------------------------------
+void WatermarkInstance::AdoptWatermarkDefinition(WatermarkDefinition* pWatermarkDefinition)
+{
+    if (this->m_pWatermarkDefinition != pWatermarkDefinition)
+    {
+        delete this->m_pWatermarkDefinition;
+        this->m_pWatermarkDefinition = pWatermarkDefinition;
+    }
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the watermark definition property.
+//          The WatermarkDefinition is the type of watermark definition.
+// RETURNS: The pointer to the orphaned WatermarkDefinition object. It may be NULL.
+//-------------------------------------------------------------------------
+WatermarkDefinition* WatermarkInstance::OrphanWatermarkDefinition()
+{
+    WatermarkDefinition* pRet = this->m_pWatermarkDefinition;
+    this->m_pWatermarkDefinition = NULL;
+    return pRet;
+}
+
+//-------------------------------------------------------------------------
+// Determines whether this instance is the same as the supplied one.
+//-------------------------------------------------------------------------
 bool WatermarkInstance::Equals(WatermarkInstance* another)
 {
-    if(!another) return false;
-    if(::wcscmp(this->m_strWatermarkResourceID.c_str(), 
-        another->m_strWatermarkResourceID.c_str())) 
+    if (!another)
         return false;
-    if(!this->m_appearanceOverride)
+
+    // check resource ID
+    if (::wcscmp(this->m_strResourceId.c_str(), another->m_strResourceId.c_str())) 
+        return false;
+
+    // check appearance
+    if (!this->m_appearanceOverride)
     {
-        if(another->m_appearanceOverride) return false;
+        if (another->m_appearanceOverride)
+            return false;
     }
-    else if(!this->m_appearanceOverride->Equals(another->m_appearanceOverride))
+    else if (!this->m_appearanceOverride->Equals(another->m_appearanceOverride))
         return false;
 
-    if(!this->m_positionOverride)
+    // check position
+    if (!this->m_positionOverride)
     {
-        return !(another->m_positionOverride);
+        if (another->m_positionOverride)
+            return false;
     }
-    else
-    {
-        return this->m_positionOverride->Equals(another->m_positionOverride);
-    }
+    else if (!this->m_positionOverride->Equals(another->m_positionOverride))
+        return false;
+
+    // all checks passed
+    return true;
 }
 
 #ifdef _WIN32

Modified: trunk/MgDev/Common/MdfModel/WatermarkInstance.h
===================================================================
--- trunk/MgDev/Common/MdfModel/WatermarkInstance.h	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/WatermarkInstance.h	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -33,7 +33,7 @@
     // reference of a WatermarkDefinition object. It is the user's responsibility to ensure
     // that duplicated WatermarkDefinitions are deleted.
     //------------------------------------------------------------------------
-class MDFMODEL_API WatermarkInstance
+    class MDFMODEL_API WatermarkInstance
     {
     public:
 
@@ -42,7 +42,7 @@
         {
             WMS = 1,
             Viewer = 2,
-            ALL = WMS | Viewer
+            All = WMS | Viewer
         };
 
         // Construction, destruction, initialization.
@@ -50,39 +50,40 @@
         virtual ~WatermarkInstance();
 
         // Operations
+
         // Property : Name
-        // The name of WatermarkInstance. Must be a unique WatermarkInstance name.
+        // The name of WatermarkInstance.  Must be a unique WatermarkInstance name.
         const MdfString& GetName() const;
         void SetName(const MdfString& strName);
 
-        //Property : WatermarkResourceID
-        // The Watermark ResourceID that this WatermarkInstance refers to for its WatermarkDefinition object
-        const MdfString& GetWatermarkResourceID() const;
-        void SetWatermarkResourceID(const MdfString& strWaterResourceID);
+        // Property : ResourceId
+        // The Watermark resource ID that this WatermarkInstance refers to for its WatermarkDefinition object.
+        const MdfString& GetResourceId() const;
+        void SetResourceId(const MdfString& strResourceId);
 
         // Property: Usage
         const Usage GetUsage() const;
         void SetUsage(Usage usage);
 
-        // Property : WatermarkDefinition
-        // WatermarkDefinition that this WatermarkInstance refers to.
-        const WatermarkDefinition* GetWatermarkDefinition() const;
-        WatermarkDefinition* GetWatermarkDefinition();
-        void AdoptWatermarkDefinition(WatermarkDefinition *pWatermarkDefinition);
-        WatermarkDefinition* OrphanWatermarkDefinition();
-
         // Property: AppearanceOverride
         const WatermarkAppearance* GetAppearanceOverride() const;
         WatermarkAppearance* GetAppearanceOverride();
-        void AdoptAppearanceOverride(WatermarkAppearance *pAppearanceOverride);
+        void AdoptAppearanceOverride(WatermarkAppearance* pAppearanceOverride);
         WatermarkAppearance* OrphanAppearanceOverride();
 
         // Property: PositionOverride
         const WatermarkPosition* GetPositionOverride() const;
         WatermarkPosition* GetPositionOverride();
-        void AdoptPositionOverride(WatermarkPosition *pPositionOverride);
+        void AdoptPositionOverride(WatermarkPosition* pPositionOverride);
         WatermarkPosition* OrphanPositionOverride();
 
+        // Property : WatermarkDefinition
+        // WatermarkDefinition that this WatermarkInstance refers to.
+        const WatermarkDefinition* GetWatermarkDefinition() const;
+        WatermarkDefinition* GetWatermarkDefinition();
+        void AdoptWatermarkDefinition(WatermarkDefinition* pWatermarkDefinition);
+        WatermarkDefinition* OrphanWatermarkDefinition();
+
         bool Equals(WatermarkInstance* another);
 
 //#ifdef _WIN32
@@ -94,17 +95,17 @@
 
     private:
         // Hidden WatermarkInstance copy constructor and assignment operator.
-         WatermarkInstance(const WatermarkInstance&);
-         WatermarkInstance& operator=(const WatermarkInstance&);
+        WatermarkInstance(const WatermarkInstance&);
+        WatermarkInstance& operator=(const WatermarkInstance&);
 
         // Data members
         // See corresponding properties for descriptions
-         MdfString m_strName;
-         MdfString m_strWatermarkResourceID;
-         Usage m_usage;
-         WatermarkDefinition* m_pWatermarkDefinition;
-         WatermarkAppearance* m_appearanceOverride;
-         WatermarkPosition* m_positionOverride;
+        MdfString m_strName;
+        MdfString m_strResourceId;
+        Usage m_usage;
+        WatermarkAppearance* m_appearanceOverride;
+        WatermarkPosition* m_positionOverride;
+        WatermarkDefinition* m_pWatermarkDefinition;
     };
 
     typedef MdfOwnerCollection<WatermarkInstance> WatermarkInstanceCollection;

Modified: trunk/MgDev/Common/MdfModel/WatermarkOffsetUnit.h
===================================================================
--- trunk/MgDev/Common/MdfModel/WatermarkOffsetUnit.h	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/WatermarkOffsetUnit.h	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -20,14 +20,14 @@
 
 #include "MdfModel.h"
 
+BEGIN_NAMESPACE_MDFMODEL
 
-namespace MdfModel{
-    namespace WatermarkOffset {
-
+    namespace WatermarkOffset
+    {
         //-------------------------------------------------------------------------
         // DESCRIPTION:
-        // The WatermarkOffsetUnit enum is to describe the content of the Unit property
-        // in watermark offset.
+        // The WatermarkOffsetUnit enum is to describe the content of the Unit
+        // property in watermark offset.
         //------------------------------------------------------------------------
         enum WatermarkOffsetUnit
         {
@@ -38,5 +38,6 @@
             Points
         };
     }
-}
+
+END_NAMESPACE_MDFMODEL
 #endif // WATERMARKOFFSETUNIT_H_

Modified: trunk/MgDev/Common/MdfModel/WatermarkPosition.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/WatermarkPosition.cpp	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/WatermarkPosition.cpp	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser

Modified: trunk/MgDev/Common/MdfModel/WatermarkPosition.h
===================================================================
--- trunk/MgDev/Common/MdfModel/WatermarkPosition.h	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/WatermarkPosition.h	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -27,7 +27,7 @@
     // The WatermarkPosition class is the abstract class of position.
     // It doesn't contain any field inside itself.
     //------------------------------------------------------------------------
-class MDFMODEL_API WatermarkPosition
+    class MDFMODEL_API WatermarkPosition
     {
     public:
         // Destruction
@@ -35,7 +35,6 @@
 
         virtual bool Equals(WatermarkPosition* another) = 0;
 
-    private:
     protected:
         // Construction, initialization
         // Default constructor is protected to make this class abstract.

Modified: trunk/MgDev/Common/MdfModel/WatermarkXOffset.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/WatermarkXOffset.cpp	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/WatermarkXOffset.cpp	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -21,8 +21,8 @@
 // WatermarkXOffset class is to define the offset of watermark at one dimension.
 //-------------------------------------------------------------------------
 
+#include "stdafx.h"
 #include <cmath>
-#include "stdafx.h"
 #include "WatermarkXOffset.h"
 
 using namespace MDFMODEL_NAMESPACE;
@@ -33,9 +33,10 @@
 // PURPOSE: Construct and initialize an instance of the WatermarkXOffset class.
 //-------------------------------------------------------------------------
 WatermarkXOffset::WatermarkXOffset()
-: m_unit(WatermarkOffset::Pixels)
-, m_alignment(Center)
 {
+    this->m_offset = 0.0;
+    this->m_unit = WatermarkOffset::Points;
+    this->m_alignment = Center;
 }
 
 //-------------------------------------------------------------------------
@@ -46,19 +47,19 @@
 }
 
 //-------------------------------------------------------------------------
-// Get the offset length 
+// Get the offset length.
 //-------------------------------------------------------------------------
-double WatermarkXOffset::GetLength() const
+double WatermarkXOffset::GetOffset() const
 {
-    return this->m_length;
+    return this->m_offset;
 }
 
 //-------------------------------------------------------------------------
-// Set the offset length 
+// Set the offset length.
 //-------------------------------------------------------------------------
-void WatermarkXOffset::SetLength(const double& dLength)
+void WatermarkXOffset::SetOffset(const double& dOffset)
 {
-    this->m_length = dLength;
+    this->m_offset = dOffset;
 }
 
 //-------------------------------------------------------------------------
@@ -99,12 +100,15 @@
     this->m_alignment = alignment;
 }
 
+//-------------------------------------------------------------------------
+// Determines whether this offset is the same as the supplied one.
+//-------------------------------------------------------------------------
 bool WatermarkXOffset::Equals(WatermarkXOffset* another)
 {
-    return another
-            && fabs(this->m_length - another->m_length) < doubleTolerance
-            && this->m_unit == another->m_unit
-            && this->m_alignment == another->m_alignment;
+    return another &&
+           fabs(this->m_offset - another->m_offset) < doubleTolerance &&
+           this->m_unit == another->m_unit &&
+           this->m_alignment == another->m_alignment;
 }
 
 #ifdef _WIN32

Modified: trunk/MgDev/Common/MdfModel/WatermarkXOffset.h
===================================================================
--- trunk/MgDev/Common/MdfModel/WatermarkXOffset.h	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/WatermarkXOffset.h	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -44,9 +44,9 @@
         virtual ~WatermarkXOffset();
 
         // Operations
-        // Property: Length
-        double GetLength() const;
-        void SetLength(const double& dLength);
+        // Property: Offset
+        double GetOffset() const;
+        void SetOffset(const double& dOffset);
 
         // Property : Unit
         WatermarkOffset::WatermarkOffsetUnit GetUnit() const;
@@ -67,19 +67,18 @@
 
     private:
         // Hidden WatermarkXOffset copy constructor and assignment operator.
-         WatermarkXOffset(const WatermarkXOffset&);
-         WatermarkXOffset& operator=(const WatermarkXOffset&);
+        WatermarkXOffset(const WatermarkXOffset&);
+        WatermarkXOffset& operator=(const WatermarkXOffset&);
 
-
         // Data members
         // See corresponding properties for descriptions
-         double m_length;
+        double m_offset;
 
         // The meaning of the string in the Unit property.
-         WatermarkOffset::WatermarkOffsetUnit m_unit;
+        WatermarkOffset::WatermarkOffsetUnit m_unit;
 
         // The meaning of the string in the Alignment property.
-         HorizontalAlignment m_alignment;
+        HorizontalAlignment m_alignment;
 
         static const double doubleTolerance;
     };

Modified: trunk/MgDev/Common/MdfModel/WatermarkYOffset.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/WatermarkYOffset.cpp	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/WatermarkYOffset.cpp	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -21,8 +21,8 @@
 // WatermarkYOffset class is to define the offset of watermark at one dimension.
 //-------------------------------------------------------------------------
 
+#include "stdafx.h"
 #include <cmath>
-#include "stdafx.h"
 #include "WatermarkYOffset.h"
 
 using namespace MDFMODEL_NAMESPACE;
@@ -33,9 +33,10 @@
 // PURPOSE: Construct and initialize an instance of the WatermarkYOffset class.
 //-------------------------------------------------------------------------
 WatermarkYOffset::WatermarkYOffset()
-: m_unit(WatermarkOffset::Pixels)
-, m_alignment(Center)
 {
+    this->m_offset = 0.0;
+    this->m_unit = WatermarkOffset::Points;
+    this->m_alignment = Center;
 }
 
 //-------------------------------------------------------------------------
@@ -46,19 +47,19 @@
 }
 
 //-------------------------------------------------------------------------
-// Get the offset length 
+// Get the offset length.
 //-------------------------------------------------------------------------
-double WatermarkYOffset::GetLength() const
+double WatermarkYOffset::GetOffset() const
 {
-    return this->m_length;
+    return this->m_offset;
 }
 
 //-------------------------------------------------------------------------
-// Set the offset length 
+// Set the offset length.
 //-------------------------------------------------------------------------
-void WatermarkYOffset::SetLength(const double& dLength)
+void WatermarkYOffset::SetOffset(const double& dOffset)
 {
-    this->m_length = dLength;
+    this->m_offset = dOffset;
 }
 
 //-------------------------------------------------------------------------
@@ -99,12 +100,15 @@
     this->m_alignment = alignment;
 }
 
+//-------------------------------------------------------------------------
+// Determines whether this offset is the same as the supplied one.
+//-------------------------------------------------------------------------
 bool WatermarkYOffset::Equals(WatermarkYOffset* another)
 {
-    return another
-            && fabs(this->m_length - another->m_length) < doubleTolerance
-            && this->m_unit == another->m_unit
-            && this->m_alignment == another->m_alignment;
+    return another &&
+           fabs(this->m_offset - another->m_offset) < doubleTolerance &&
+           this->m_unit == another->m_unit &&
+           this->m_alignment == another->m_alignment;
 }
 
 #ifdef _WIN32

Modified: trunk/MgDev/Common/MdfModel/WatermarkYOffset.h
===================================================================
--- trunk/MgDev/Common/MdfModel/WatermarkYOffset.h	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/WatermarkYOffset.h	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -25,7 +25,7 @@
 
     //-------------------------------------------------------------------------
     // DESCRIPTION:
-    // The WatermarkOffest class is to define the offset in Y-axis of the watermark.
+    // The WatermarkYOffest class is to define the offset in Y-axis of the watermark.
     //------------------------------------------------------------------------
     class MDFMODEL_API WatermarkYOffset
     {
@@ -44,9 +44,9 @@
         virtual ~WatermarkYOffset();
 
         // Operations
-        // Property: Length
-        double GetLength() const;
-        void SetLength(const double& dLength);
+        // Property: Offset
+        double GetOffset() const;
+        void SetOffset(const double& dOffset);
 
         // Property : Unit
         WatermarkOffset::WatermarkOffsetUnit GetUnit() const;
@@ -67,19 +67,18 @@
 
     private:
         // Hidden WatermarkYOffset copy constructor and assignment operator.
-         WatermarkYOffset(const WatermarkYOffset&);
-         WatermarkYOffset& operator=(const WatermarkYOffset&);
+        WatermarkYOffset(const WatermarkYOffset&);
+        WatermarkYOffset& operator=(const WatermarkYOffset&);
 
-
         // Data members
         // See corresponding properties for descriptions
-         double m_length;
+        double m_offset;
 
         // The meaning of the string in the Unit property.
-         WatermarkOffset::WatermarkOffsetUnit m_unit;
+        WatermarkOffset::WatermarkOffsetUnit m_unit;
 
         // The meaning of the string in the Alignment property.
-         VerticalAlignment m_alignment;
+        VerticalAlignment m_alignment;
 
         static const double doubleTolerance;
     };

Modified: trunk/MgDev/Common/MdfModel/XYWatermarkPosition.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/XYWatermarkPosition.cpp	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/XYWatermarkPosition.cpp	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -31,9 +31,9 @@
 // PURPOSE: Construct and initialize an instance of the XYWatermarkPosition class.
 //-------------------------------------------------------------------------
 XYWatermarkPosition::XYWatermarkPosition()
-: m_XPosition(NULL)
-, m_YPosition(NULL)
 {
+    this->m_XPosition = NULL;
+    this->m_YPosition = NULL;
 }
 
 //-------------------------------------------------------------------------
@@ -73,7 +73,7 @@
 //          pXPosition - Adopted WatermarkXOffset object that is created on the heap.
 //                             It may be NULL.
 //-------------------------------------------------------------------------
-void XYWatermarkPosition::AdoptXPosition(WatermarkXOffset *pXPosition)
+void XYWatermarkPosition::AdoptXPosition(WatermarkXOffset* pXPosition)
 {
     if (this->m_XPosition != pXPosition)
     {
@@ -122,7 +122,7 @@
 //          pYPosition - Adopted WatermarkYOffset object that is created on the heap.
 //                             It may be NULL.
 //-------------------------------------------------------------------------
-void XYWatermarkPosition::AdoptYPosition(WatermarkYOffset *pYPosition)
+void XYWatermarkPosition::AdoptYPosition(WatermarkYOffset* pYPosition)
 {
     if (this->m_YPosition != pYPosition)
     {
@@ -143,26 +143,35 @@
     return pRet;
 }
 
+//-------------------------------------------------------------------------
+// Determines whether this position is the same as the supplied one.
+//-------------------------------------------------------------------------
 bool XYWatermarkPosition::Equals(WatermarkPosition* another)
 {
     XYWatermarkPosition* anotherPosition = dynamic_cast<XYWatermarkPosition*>(another);
-    if(!anotherPosition) return false;
+    if (!anotherPosition)
+        return false;
     
-    if(!this->m_XPosition)
+    // check X position
+    if (!this->m_XPosition)
     {
-        if(anotherPosition->m_XPosition) return false;
+        if (anotherPosition->m_XPosition)
+            return false;
     }
-    else if(!this->m_XPosition->Equals(anotherPosition->m_XPosition))
+    else if (!this->m_XPosition->Equals(anotherPosition->m_XPosition))
         return false;
 
-    if(!this->m_YPosition)
+    // check Y position
+    if (!this->m_YPosition)
     {
-        return !anotherPosition->m_YPosition;
+        if (anotherPosition->m_YPosition)
+            return false;
     }
-    else
-    {
-        return this->m_YPosition->Equals(anotherPosition->m_YPosition);
-    }
+    else if (!this->m_YPosition->Equals(anotherPosition->m_YPosition))
+        return false;
+
+    // all checks passed
+    return true;
 }
 
 #ifdef _WIN32

Modified: trunk/MgDev/Common/MdfModel/XYWatermarkPosition.h
===================================================================
--- trunk/MgDev/Common/MdfModel/XYWatermarkPosition.h	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfModel/XYWatermarkPosition.h	2010-09-17 22:23:54 UTC (rev 5148)
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2004-2010 by Autodesk, Inc.
+//  Copyright (C) 2010 by Autodesk, Inc.
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of version 2.1 of the GNU Lesser
@@ -30,7 +30,7 @@
     // The XYWatermarkPosition class is one concrete implementation of WatermarkPosition.
     // It uses X-Y as the position of watermark.
     //------------------------------------------------------------------------
-class MDFMODEL_API XYWatermarkPosition: public WatermarkPosition
+    class MDFMODEL_API XYWatermarkPosition: public WatermarkPosition
     {
     public:
         // Construction, destruction, initialization.
@@ -42,13 +42,13 @@
         // Property: XPosition
         const WatermarkXOffset* GetXPosition() const;
         WatermarkXOffset* GetXPosition();
-        void AdoptXPosition(WatermarkXOffset *pXPosition);
+        void AdoptXPosition(WatermarkXOffset* pXPosition);
         WatermarkXOffset* OrphanXPosition();
         
         // Property: YPosition
         const WatermarkYOffset* GetYPosition() const;
         WatermarkYOffset* GetYPosition();
-        void AdoptYPosition(WatermarkYOffset *pYPosition);
+        void AdoptYPosition(WatermarkYOffset* pYPosition);
         WatermarkYOffset* OrphanYPosition();
 
         virtual bool Equals(WatermarkPosition* another);
@@ -62,13 +62,13 @@
 
     private:
         // Hidden XYWatermarkPosition copy constructor and assignment operator.
-         XYWatermarkPosition(const XYWatermarkPosition&);
-         XYWatermarkPosition& operator=(const XYWatermarkPosition&);
+        XYWatermarkPosition(const XYWatermarkPosition&);
+        XYWatermarkPosition& operator=(const XYWatermarkPosition&);
 
         // Data members
         // See corresponding properties for descriptions
-         WatermarkXOffset* m_XPosition;
-         WatermarkYOffset* m_YPosition;
+        WatermarkXOffset* m_XPosition;
+        WatermarkYOffset* m_YPosition;
     };
 
 END_NAMESPACE_MDFMODEL

Modified: trunk/MgDev/Common/MdfParser/IOWatermarkInstance.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOWatermarkInstance.cpp	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfParser/IOWatermarkInstance.cpp	2010-09-17 22:23:54 UTC (rev 5148)
@@ -105,7 +105,7 @@
         break;
 
     case eResourceId:
-        this->m_watermark->SetWatermarkResourceID(ch);
+        this->m_watermark->SetResourceId(ch);
         break;
     case eUsage:
         if (::wcscmp(ch, L"WMS") == 0) // NOXLATE
@@ -113,7 +113,7 @@
         else if (::wcscmp(ch, L"Viewer") == 0) // NOXLATE
             this->m_watermark->SetUsage(WatermarkInstance::Viewer);
         else
-            this->m_watermark->SetUsage(WatermarkInstance::ALL);  //Treat as "ALL" if string is incorrect
+            this->m_watermark->SetUsage(WatermarkInstance::All);  //Treat as "All" if string is incorrect
         break;
     }
 }
@@ -140,7 +140,7 @@
     fd << EncodeString(watermark->GetName());
     fd << endStr(sName) << std::endl;
     fd << tab() << startStr(sResourceId);
-    fd << EncodeString(watermark->GetWatermarkResourceID());
+    fd << EncodeString(watermark->GetResourceId());
     fd << endStr(sResourceId) << std::endl;
 
     fd << tab() << startStr(sUsage);

Modified: trunk/MgDev/Common/MdfParser/IOWatermarkXOffset.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOWatermarkXOffset.cpp	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfParser/IOWatermarkXOffset.cpp	2010-09-17 22:23:54 UTC (rev 5148)
@@ -70,7 +70,7 @@
     switch (this->m_currElemId)
     {
     case eOffset:
-        this->m_XOffset->SetLength(wstrToDouble(ch));
+        this->m_XOffset->SetOffset(wstrToDouble(ch));
         break;
 
     case eAlignment:
@@ -107,7 +107,7 @@
     inctab();
 
     fd << tab() << startStr(sOffset);
-    fd << DoubleToStr(xOffset->GetLength());
+    fd << DoubleToStr(xOffset->GetOffset());
     fd << endStr(sOffset) << std::endl;
 
     IOWatermarkOffsetUnit::Write(fd, xOffset->GetUnit());

Modified: trunk/MgDev/Common/MdfParser/IOWatermarkYOffset.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOWatermarkYOffset.cpp	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/MdfParser/IOWatermarkYOffset.cpp	2010-09-17 22:23:54 UTC (rev 5148)
@@ -70,7 +70,7 @@
     switch (this->m_currElemId)
     {
     case eOffset:
-        this->m_YOffset->SetLength(wstrToDouble(ch));
+        this->m_YOffset->SetOffset(wstrToDouble(ch));
         break;
 
     case eAlignment:
@@ -107,7 +107,7 @@
     inctab();
 
     fd << tab() << startStr(sOffset);
-    fd << DoubleToStr(yOffset->GetLength());
+    fd << DoubleToStr(yOffset->GetOffset());
     fd << endStr(sOffset) << std::endl;
 
     IOWatermarkOffsetUnit::Write(fd, yOffset->GetUnit());

Modified: trunk/MgDev/Common/Schema/WatermarkDefinition-1.0.0.xsd
===================================================================
--- trunk/MgDev/Common/Schema/WatermarkDefinition-1.0.0.xsd	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Common/Schema/WatermarkDefinition-1.0.0.xsd	2010-09-17 22:23:54 UTC (rev 5148)
@@ -15,7 +15,7 @@
   </xs:element>
   <xs:simpleType name="UnitType">
     <xs:annotation>
-      <xs:documentation>Unit for watermark</xs:documentation>
+      <xs:documentation>Unit for a watermark.</xs:documentation>
     </xs:annotation>
     <xs:restriction base="xs:string">
       <xs:enumeration value="Inches"/>
@@ -27,7 +27,7 @@
   </xs:simpleType>
   <xs:simpleType name="HorizontalAlignmentType">
     <xs:annotation>
-      <xs:documentation>Horizontal alignment for watermark</xs:documentation>
+      <xs:documentation>Horizontal alignment for a watermark.</xs:documentation>
     </xs:annotation>
     <xs:restriction base="xs:string">
       <xs:enumeration value="Left"/>
@@ -37,7 +37,7 @@
   </xs:simpleType>
   <xs:complexType name="HorizontalPositionType">
     <xs:annotation>
-      <xs:documentation>Horizontal position of watermark</xs:documentation>
+      <xs:documentation>Horizontal position of a watermark.</xs:documentation>
     </xs:annotation>
     <xs:sequence>
       <xs:element name="Offset" type="xs:double" default="0">
@@ -59,7 +59,7 @@
   </xs:complexType>
   <xs:simpleType name="VerticalAlignmentType">
     <xs:annotation>
-      <xs:documentation>Vertical alignment for watermark</xs:documentation>
+      <xs:documentation>Vertical alignment for a watermark.</xs:documentation>
     </xs:annotation>
     <xs:restriction base="xs:string">
       <xs:enumeration value="Top"/>
@@ -69,7 +69,7 @@
   </xs:simpleType>
   <xs:complexType name="VerticalPositionType">
     <xs:annotation>
-      <xs:documentation>Vertical position of watermark</xs:documentation>
+      <xs:documentation>Vertical position of a watermark.</xs:documentation>
     </xs:annotation>
     <xs:sequence>
       <xs:element name="Offset" type="xs:double" default="0">
@@ -79,7 +79,7 @@
       </xs:element>
       <xs:element name="Unit" type="UnitType" default="Points">
         <xs:annotation>
-          <xs:documentation>Vertical for horizontal offset</xs:documentation>
+          <xs:documentation>Unit for vertical offset</xs:documentation>
         </xs:annotation>
       </xs:element>
       <xs:element name="Alignment" type="VerticalAlignmentType"  default="Center">
@@ -91,7 +91,7 @@
   </xs:complexType>
   <xs:complexType name="PositionType" abstract="true">
     <xs:annotation>
-      <xs:documentation>Abstract position type for watermark.</xs:documentation>
+      <xs:documentation>Abstract position type for a watermark.</xs:documentation>
     </xs:annotation>
     <xs:sequence>
     </xs:sequence>
@@ -150,12 +150,12 @@
   </xs:complexType>
   <xs:complexType name="WatermarkAppearanceType">
     <xs:annotation>
-      <xs:documentation>Appearance of watermark</xs:documentation>
+      <xs:documentation>Appearance of a watermark.</xs:documentation>
     </xs:annotation>
     <xs:sequence>
       <xs:element name="Transparency" minOccurs="0" default="0">
         <xs:annotation>
-          <xs:documentation>The transparency of watermark (0 -100). The default value is 0 (opaque).</xs:documentation>
+          <xs:documentation>The transparency of a watermark (0 -100).  The default value is 0 (opaque).</xs:documentation>
         </xs:annotation>
         <xs:simpleType>
           <xs:restriction base="xs:double">
@@ -166,7 +166,7 @@
       </xs:element>
       <xs:element name="Rotation" minOccurs="0" default="0">
         <xs:annotation>
-          <xs:documentation>The rotation of watermark (0-360). The default value is 0</xs:documentation>
+          <xs:documentation>The rotation of a watermark (0-360), in degrees.  The default value is 0</xs:documentation>
         </xs:annotation>
         <xs:simpleType>
           <xs:restriction base="xs:double">
@@ -179,7 +179,7 @@
   </xs:complexType>
   <xs:complexType name="WatermarkDefinitionType">
     <xs:annotation>
-      <xs:documentation>Watermark definition contains content and position of watermark</xs:documentation>
+      <xs:documentation>Watermark definition contains content and position of watermark.</xs:documentation>
     </xs:annotation>
     <xs:sequence>
       <xs:element name="WatermarkSource">
@@ -203,18 +203,18 @@
       </xs:element>
       <xs:element name="Appearance" type="WatermarkAppearanceType">
         <xs:annotation>
-          <xs:documentation>The appearance of watermark.</xs:documentation>
+          <xs:documentation>The appearance of the watermark.</xs:documentation>
         </xs:annotation>
       </xs:element>
       <xs:element name="Position">
         <xs:annotation>
-          <xs:documentation>Position of watermark</xs:documentation>
+          <xs:documentation>The position of the watermark</xs:documentation>
         </xs:annotation>
         <xs:complexType>
           <xs:choice>
             <xs:element name="XYPosition" type="XYPositionType">
               <xs:annotation>
-                <xs:documentation>A X-Y position</xs:documentation>
+                <xs:documentation>X-Y position</xs:documentation>
               </xs:annotation>
             </xs:element>
             <xs:element name="TilePosition" type="TilePositionType">
@@ -230,7 +230,7 @@
   </xs:complexType>
   <xs:simpleType name="UsageType">
     <xs:annotation>
-      <xs:documentation>The situation that watermark can be used.</xs:documentation>
+      <xs:documentation>The context in which the watermark can be used.</xs:documentation>
     </xs:annotation>
     <xs:restriction base="xs:string">
       <xs:enumeration value="WMS">
@@ -245,7 +245,7 @@
       </xs:enumeration>
       <xs:enumeration value="ALL">
         <xs:annotation>
-          <xs:documentation>Watermark can show in all situation.</xs:documentation>
+          <xs:documentation>Watermark can show in all situations.</xs:documentation>
         </xs:annotation>
       </xs:enumeration>
     </xs:restriction>
@@ -265,9 +265,9 @@
           <xs:documentation>A reference to an existing watermark definition.</xs:documentation>
         </xs:annotation>
       </xs:element>
-      <xs:element name="Usage" type="UsageType" minOccurs="0" default="ALL">
+      <xs:element name="Usage" type="UsageType" minOccurs="0" default="All">
         <xs:annotation>
-          <xs:documentation>The situation that watermark can be used. The default value is ALL.</xs:documentation>
+          <xs:documentation>The context in which the watermark can be used.  The default value is All.</xs:documentation>
         </xs:annotation>
       </xs:element>
       <xs:element name="AppearanceOverrides" type="WatermarkAppearanceType" minOccurs="0">
@@ -299,7 +299,7 @@
   </xs:complexType>
   <xs:complexType name="WatermarkInstanceCollectionType">
     <xs:annotation>
-      <xs:documentation>A collection of watermark used by map or layer.</xs:documentation>
+      <xs:documentation>A collection of watermarks used by a map or layer.</xs:documentation>
     </xs:annotation>
     <xs:sequence>
       <xs:element name="Watermark" type="WatermarkType" minOccurs="0" maxOccurs="unbounded">

Modified: trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2010-09-17 20:23:27 UTC (rev 5147)
+++ trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2010-09-17 22:23:54 UTC (rev 5148)
@@ -940,9 +940,11 @@
             }
         }
 
-        if(renderingWatermark)
+        if (renderingWatermark)
         {
-            //Rendering watermark
+            // Rendering watermark
+
+            // TODO: Don't allocate objects on heap if unnecessary!!!!!!!!!!!!!!
             Ptr<MgStringCollection> watermarkIds = new MgStringCollection(); //ID list to load watermark definition
             auto_ptr<WatermarkInstanceCollection> watermarkInstances(
                 new WatermarkInstanceCollection());     //Watermark list to render
@@ -950,111 +952,115 @@
                 new WatermarkInstanceCollection());    //Used to reverse list
             auto_ptr<WatermarkInstance> tempInstance;
 
-            //Get watermark instance in map
+            // Get watermark instance in map
             Ptr<MgResourceIdentifier> mapId = map->GetMapDefinition();
-            if(mapId.p)
+            if (mapId.p)
             {
-                auto_ptr<MapDefinition> mdef(
-                    MgMapBase::GetMapDefinition(m_svcResource, mapId));
+                auto_ptr<MapDefinition> mdef(MgMapBase::GetMapDefinition(m_svcResource, mapId));
                 WatermarkInstanceCollection* mapWatermarks = mdef->GetWatermarks();
-                for(int i = mapWatermarks->GetCount()-1; i>=0; i--)
+                for (int i=mapWatermarks->GetCount()-1; i>=0; i--)
                     tempWatermarkInstances->Adopt(mapWatermarks->OrphanAt(i));
-                for(int i = tempWatermarkInstances->GetCount()-1; i>=0; i--)
+                for (int i=tempWatermarkInstances->GetCount()-1; i>=0; i--)
                 {
                     tempInstance.reset(tempWatermarkInstances->OrphanAt(i));
-                    if(!tempInstance.get()) continue;
-                    if(((map->GetWatermarkUsage() & MgMap::Viewer) != 0
+                    if (!tempInstance.get())
+                        continue;
+                    if (((map->GetWatermarkUsage() & MgMap::Viewer) != 0
                         && (tempInstance->GetUsage() & WatermarkInstance::Viewer) == 0) 
                         || ((map->GetWatermarkUsage() & MgMap::WMS) != 0
                         && (tempInstance->GetUsage() & WatermarkInstance::WMS) == 0))
                         continue;
+
                     bool alreadyInList = false;
-                    for(int j = watermarkInstances->GetCount()-1; j >=0; j--)
+                    for (int j=watermarkInstances->GetCount()-1; j >=0; j--)
                     {
-                        if(tempInstance->Equals(watermarkInstances->GetAt(j)))
+                        if (tempInstance->Equals(watermarkInstances->GetAt(j)))
                         {
                             alreadyInList = true;
                             break;
                         }
                     }
-                    if(!alreadyInList)
+
+                    if (!alreadyInList)
                     {
-                        watermarkIds->Add(tempInstance->GetWatermarkResourceID().c_str());
+                        watermarkIds->Add(tempInstance->GetResourceId().c_str());
                         watermarkInstances->Adopt(tempInstance.release());
                     }
                 }
             }
 
-            //Get watermark instance in layer
+            // Get watermark instance in layer
             const int layerCount = tempLayers->GetCount();
             auto_ptr<LayerDefinition> ldf;
-            for(int i = 0; i < layerCount; i++)
+            for (int i=0; i<layerCount; ++i)
             {
                 Ptr<MgLayerBase> mapLayer(tempLayers->GetItem(i));
 
-                //The layer resource content should be set during stylization.
-                if(mapLayer->GetLayerResourceContent() == L"")
+                // the layer resource content should be set during stylization
+                if (mapLayer->GetLayerResourceContent() == L"")
                     continue;
 
                 ldf.reset(MgLayerBase::GetLayerDefinition(mapLayer->GetLayerResourceContent()));
                 
                 WatermarkInstanceCollection* layerWatermarks = ldf->GetWatermarks();
-                for(int j = layerWatermarks->GetCount()-1; j>=0; j--)
+                for (int j=layerWatermarks->GetCount()-1; j>=0; j--)
                     tempWatermarkInstances->Adopt(layerWatermarks->OrphanAt(j));
-                for(int j = tempWatermarkInstances->GetCount()-1; j>=0; j--)
+                for (int j=tempWatermarkInstances->GetCount()-1; j>=0; j--)
                 {
                     tempInstance.reset(tempWatermarkInstances->OrphanAt(j));
-                    if(!tempInstance.get()) continue;
-                    if(((map->GetWatermarkUsage() & MgMap::Viewer) != 0
+                    if (!tempInstance.get())
+                        continue;
+                    if (((map->GetWatermarkUsage() & MgMap::Viewer) != 0
                         && (tempInstance->GetUsage() & WatermarkInstance::Viewer) == 0) 
                         || ((map->GetWatermarkUsage() & MgMap::WMS) != 0
                         && (tempInstance->GetUsage() & WatermarkInstance::WMS) == 0))
                         continue;
+
                     bool alreadyInList = false;
-                    for(int k = watermarkInstances->GetCount()-1; k >=0; k--)
+                    for (int k=watermarkInstances->GetCount()-1; k>=0; k--)
                     {
-                        if(tempInstance->Equals(watermarkInstances->GetAt(k)))
+                        if (tempInstance->Equals(watermarkInstances->GetAt(k)))
                         {
                             alreadyInList = true;
                             break;
                         }
                     }
-                    if(!alreadyInList)
+
+                    if (!alreadyInList)
                     {
-                        watermarkIds->Add(tempInstance->GetWatermarkResourceID().c_str());
+                        watermarkIds->Add(tempInstance->GetResourceId().c_str());
                         watermarkInstances->Adopt(tempInstance.release());
                     }
                 }
             }
             assert(tempWatermarkInstances->GetCount() == 0);
 
-            //Load watermark source
-            if(watermarkIds->GetCount() != 0)
+            // load watermark source
+            if (watermarkIds->GetCount() != 0)
             {
                 Ptr<MgStringCollection> wdefs = m_svcResource->GetResourceContents(watermarkIds, NULL);
-                for(int i = watermarkIds->GetCount() - 1; i >= 0; i--)
+                for (int i=watermarkIds->GetCount()-1; i>=0; i--)
                 {
-                    for(int j = watermarkInstances->GetCount() - 1; j >= 0; j--)
+                    for (int j=watermarkInstances->GetCount()-1; j>=0; j--)
                     {
                         WatermarkInstance* instance = watermarkInstances->GetAt(j);
-                        if(instance->GetWatermarkResourceID() == watermarkIds->GetItem(i))
+                        if (instance->GetResourceId() == watermarkIds->GetItem(i))
                         {
-                            instance->AdoptWatermarkDefinition(
-                                MgWatermark::GetWatermarkDefinition(wdefs->GetItem(i)));
+                            instance->AdoptWatermarkDefinition(MgWatermark::GetWatermarkDefinition(wdefs->GetItem(i)));
                         }
                     }
                 }
             }
 
-            for(int i = watermarkInstances->GetCount()-1; i>=0; i--)
+            for (int i=watermarkInstances->GetCount()-1; i>=0; i--)
             {
                 WatermarkInstance* instance = watermarkInstances->GetAt(i);
                 WatermarkDefinition* wdef = instance->GetWatermarkDefinition();
-                if(instance->GetPositionOverride())
+                if (instance->GetPositionOverride())
                 {
                     wdef->AdoptPosition(instance->OrphanPositionOverride());
                 }
-                if(instance->GetAppearanceOverride())
+                if (instance->GetAppearanceOverride())
                 {
                     wdef->AdoptAppearance(instance->GetAppearanceOverride());
                 }



More information about the mapguide-commits mailing list