OilCoord Class Reference

#include <oilcoord.h>

Inheritance diagram for OilCoord:

Coord List of all members.

Public Member Functions

 OilCoord ()
 OilCoord (MILLIPOINT xx, MILLIPOINT yy)
 Constructs an OIL coordinate.
WinCoord ToWin (View *pView) const
 Converts an OilCoord to a WinCoord.
WinCoord ToWin (const double dpi) const
 Same as above in that it converts an OilCoord to a WinCoord but instead of assuming screen dpi, as in using x/yPixelScale, it uses the specified dpi to work out the transformation. Same as above in that it converts an OilCoord to a WinCoord but instead of assuming screen dpi, as in using x/yPixelScale, it uses the specified dpi to work out the transformation. Different to above in that it takes a double dpi instead of a INT32 dpi. Now superceeds the above. Changed 12/12/95.
WorkCoord ToWork (const WorkCoord &ScrollOffset) const
 Converts an OilCoord to a WorkCoord.
void ToWork (const WorkCoord &scrollOffset, WorkCoord *result) const
 Converts an OilCoord to a WorkCoord.
DocCoord ToDoc (const Spread *pSpread, View *pView) const
 Convert an OilCoord to a DocCoord.

Friends

class OilRect

Detailed Description

Definition at line 132 of file oilcoord.h.


Constructor & Destructor Documentation

OilCoord::OilCoord  )  [inline]
 

Definition at line 137 of file oilcoord.h.

00137 : Coord() {}

OilCoord::OilCoord MILLIPOINT  xx,
MILLIPOINT  yy
 

Constructs an OIL coordinate.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27th August 1993
Parameters:
Two INT32s (measured in millipoints). [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Public

Definition at line 133 of file oilcoord.cpp.

00133                                                : Coord(xx, yy)
00134 {
00135 }


Member Function Documentation

DocCoord OilCoord::ToDoc const Spread pSpread,
View pView
const
 

Convert an OilCoord to a DocCoord.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/12/93
Parameters:
pSpread - The spread that we know that the oil coord is in [INPUTS] View - the view to use when converting.
Returns:
This coordinate as measured in DocCoords

Definition at line 305 of file oilcoord.cpp.

00306 {
00307     DocCoord    Return;
00308     WorkCoord   Point((XLONG)(this->x), (XLONG)(this->y));
00309 
00310     // First, convert the OilCoord into a LogicalCoord...
00311     FIXED16 ViewScale = pView->GetViewScale();
00312     WorkCoord ScrollOffset = pView->GetScrollOffsets();
00313 
00314     Point.x = MakeXLong( double(Point.x + ScrollOffset.x) / ViewScale.MakeDouble());
00315     Point.y = MakeXLong( double(Point.y + ScrollOffset.y) / ViewScale.MakeDouble());
00316 
00317     // Find the parent chapter
00318     Chapter* pChapter = (Chapter*) pSpread->FindParent();
00319     ENSURE( pChapter != NULL, "Spread had no parent" );
00320     ENSURE( pChapter->IsKindOf(CC_RUNTIME_CLASS(Chapter)), "Chapter is not a chapter" );
00321 
00322     // Find the depth of the chapter
00323     XLONG ChapDepth = pChapter->GetChapterDepth();
00324 
00325     // Find the chapters position
00326     DocCoord ChapterPos;
00327     ChapterPos.x = pChapter->GetPasteboardRect(TRUE, pView).lo.x; 
00328     ChapterPos.y = pChapter->GetPasteboardRect(TRUE, pView).hi.y;
00329 
00330     // Build the return value up
00331     Return.x = Point.x + ChapterPos.x;
00332     Return.y = Point.y + MakeXLong(ChapterPos.y) + ChapDepth;
00333 
00334     return (Return);
00335     
00336 }

WinCoord OilCoord::ToWin const double  dpi  )  const
 

Same as above in that it converts an OilCoord to a WinCoord but instead of assuming screen dpi, as in using x/yPixelScale, it uses the specified dpi to work out the transformation. Same as above in that it converts an OilCoord to a WinCoord but instead of assuming screen dpi, as in using x/yPixelScale, it uses the specified dpi to work out the transformation. Different to above in that it takes a double dpi instead of a INT32 dpi. Now superceeds the above. Changed 12/12/95.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/11/93
Parameters:
Transform Matrix. [INPUTS] dpi the value of the destination dpi rather than assuming screen dpi
None [OUTPUTS]
Returns:
None.

Errors: None.

Definition at line 228 of file oilcoord.cpp.

00229 {
00230     // See above ToWin routine for conversion comments
00231     // Work out our x and y pixel scaling factors for the specified destination dpi
00232     FIXED16 PixScale = 72000.0/dpi;
00233 
00234     return WinCoord(INT32(MPtoPixel(x, PixScale)), -INT32(MPtoPixel(y, PixScale) ));
00235 }

WinCoord OilCoord::ToWin View pView  )  const
 

Converts an OilCoord to a WinCoord.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/8/93
Parameters:
The view we are converting to. [INPUTS]

Definition at line 156 of file oilcoord.cpp.

00157 {
00158     // Note that we have to negate the y coord, because Windows starts with 0 at the top
00159     // and then positive coordinates in a downward direction, i.e. the opposite to
00160     // Camelot's coordinate systems.
00161 
00162     // NB. More importantly, we add 1 to the y coord, because the flipping of the y axis
00163     //     causes a misalignment in the pixel systems.  This is because Camelot coords
00164     //     specify the bottom left of the pixel, whereas GDI coords specify the top-left.
00165     //     (See coord.doc for more details)
00166 
00167 //  return WinCoord(INT32(MPtoPixel(x, xPixelScale)), -INT32(MPtoPixel(y, yPixelScale) + 1));
00168 
00169     // New info: (Phil, 17/11/94)
00170     // The one pixel bodge is no longer required because the pixel model has been modified
00171     // so that pixel coordinates are in the centres of pixels, not on any edge.
00172     // This allows coordinate systems to be negated without any extra work.
00173 
00174     // Get pixel size for this view
00175     FIXED16 PixelWidth, PixelHeight;
00176     pView->GetPixelSize(&PixelWidth, &PixelHeight);
00177 
00178     // Do the conversion and return the results.
00179     return WinCoord(INT32(MPtoPixel(x, PixelWidth)), -INT32(MPtoPixel(y, PixelHeight) ));
00180 }

void OilCoord::ToWork const WorkCoord scrollOffset,
WorkCoord result
const
 

Converts an OilCoord to a WorkCoord.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/8/93
Parameters:
Scroll offset. [INPUTS]
None [OUTPUTS]
Returns:
None.

Errors: None.

Definition at line 281 of file oilcoord.cpp.

00282 {
00283 // Implementation...
00284     // Then add the scroll offsets to get workarea values...
00285     result->x = scrollOffset.x + x; 
00286     result->y = scrollOffset.y + y;
00287 }

WorkCoord OilCoord::ToWork const WorkCoord ScrollOffset  )  const
 

Converts an OilCoord to a WorkCoord.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/8/93
Parameters:
Scroll offset. [INPUTS]
None [OUTPUTS]
Returns:
None.

Errors: None.

Definition at line 254 of file oilcoord.cpp.

00255 {
00256     // Add the scroll offsets to get workarea values...
00257     return WorkCoord(ScrollOffset.x + x, ScrollOffset.y + y);
00258 }


Friends And Related Function Documentation

friend class OilRect [friend]
 

Definition at line 134 of file oilcoord.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:57:19 2007 for Camelot by  doxygen 1.4.4