SUTheme Class Reference

Represents a ShapeUp theme or layer. More...

#include <ShapeUpAPI.h>

Inheritance diagram for SUTheme:

SUObject List of all members.

Public Member Functions

 SUTheme ()
 SUTheme (SUHANDLE hTheme)
SUShape AddShape (const CShapeRecord *shapeData)
void BatchAddShapeBegin ()
void BatchAddShapeEnd ()
void ReplaceShapeData (SUHANDLE hShape, const CShapeRecord *shapeData)
void DeleteShape (SUHANDLE hShape)
bool IsSelected ()
bool IsReadOnly ()
bool IsVisible ()
std::string GetName ()
void SetName (const char *name)
size_t GetAttributeCount ()
std::string GetAttributeName (size_t column)
unsigned long GetAttributeType (size_t column)
size_t GetAttributeIndex (const char *name)
size_t GetShapeCount ()
SUShape GetShape (size_t index)
SUShape GetShapeFromIndex (size_t index)
ShapeType GetShapeType ()
void GetBounds (SURectf &r)
void RecalcBounds ()
SURecordset GetIntersectingShapes (SUShape shape)
SURecordset GetShapesInRect (const SURectf &r, bool bPartiallyInRectOk)
size_t GetSelectionCount ()
SURecordset GetSelectedShapes ()
SURecordset GetSelectedShapesInRect (const SURectf &r, bool bPartiallyInRectOk)
std::string GetInfoTip (SUShape shape)
void GetFont (LOGFONT *font, COLORREF *clr)
SURecordset GetShapesByQuery (const char *where)
SUHANDLE LookupWorkspace ()
size_t AddAttribute (unsigned long type, const char *name, const char *defaultval=NULL)
void DeleteAttribute (size_t index)
void SetAttributeComment (size_t index, const char *comment)
std::string GetComment ()
void SetComment (const char *comment)
COLORREF GetPenColor ()
void SetPenColor (COLORREF clr)
COLORREF GetFillColor ()
void SetFillColor (COLORREF clr)
size_t GetPenWidth ()
void SetPenWidth (size_t width)
size_t GetPenStyle ()
void SetPenStyle (size_t style)
void SetRasterImage (HBITMAP hbm, double west, double south, double east, double north, const char *sourceHint)
void SetSerialData (size_t byteCount, const void *bytes)
void ClearSelection ()
void Select (bool select)
void InvertSelection ()

Detailed Description

A ShapeUp theme manages raster images or vector objects and their attributes. Data can be added, manipulated or removed.

Even though ShapeUp supports different types of vector data, such as points, lines and polygons, a single theme may currently not contain more than one type.

An SUTheme is normally retrieved from an SUWorkspace object.

Examples:

example_loadergpi.cpp.


Constructor & Destructor Documentation

SUTheme::SUTheme (  )  [inline]

Default constructor.

SUTheme::SUTheme ( SUHANDLE  hTheme  )  [inline]

Constructor.

Parameters:
hTheme is a handle to a ShapeUp theme.
See also:
SUWorkspace::GetTheme(), Workspace_GetTheme()


Member Function Documentation

SUShape SUTheme::AddShape ( const CShapeRecord *  shapeData  )  [inline]

Adds a new shape to this theme. Adding a shape updates the themes bounding box automatically.

Parameters:
shapeData is the shape to be added. ShapeUp makes a copy of this shape.
Returns:
Returns a handle to the created shape.
See also:
Theme_AddShape(), BatchAddShapeBegin(), BatchAddShapeEnd()
Examples:
example_loadergpi.cpp.

void SUTheme::BatchAddShapeBegin (  )  [inline]

Turns off indexing and other time consuming tasks when calling AddShape(). Use this if many shapes should be added at once. After the shapes have been added, call BatchAddShapeEnd() to turn the features back on again.

See also:
AddShape(), BatchAddShapeEnd(), Theme_BatchAddShapeBegin()

void SUTheme::BatchAddShapeEnd (  )  [inline]

Turns on indexing and other tasks after calling AddShape().

See also:
AddShape(), BatchAddShapeBegin(), Theme_BatchAddShapeEnd()

void SUTheme::ReplaceShapeData ( SUHANDLE  hShape,
const CShapeRecord *  shapeData 
) [inline]

Replaces a shape in this theme. After this operation, the handle hShape is still valid, but points to the new shape instead. Also, after a call to this function, the themes bounding box must be updated via a call to SUTheme::RecalcBounds()

Parameters:
hShape is a handle to the shape to replace.
shapeData is the shape to be inserted. ShapeUp makes a copy of this shape.
See also:
Theme_ReplaceShapeData(), SUTheme::RecalcBounds()

void SUTheme::DeleteShape ( SUHANDLE  hShape  )  [inline]

Deletes a shape in this theme. After this operation, the handle hShape is invalid. Also, after a call to this function, the themes bounding box must be updated via a call to SUTheme::RecalcBounds()

Parameters:
hShape is a handle to the shape to delete.
See also:
Theme_DeleteShape()

bool SUTheme::IsSelected (  )  [inline]

Queries ShapeUp if this theme is selected or not.

Returns:
True if this theme is selected, and false otherwise.
See also:
Theme_IsSelected()

bool SUTheme::IsReadOnly (  )  [inline]

Queries ShapeUp if this theme is read-only or not.

Returns:
True if this theme is read-only, and false otherwise.
See also:
Theme_IsReadOnly()

bool SUTheme::IsVisible (  )  [inline]

Queries ShapeUp if this theme is visible or not.

Returns:
True if this theme is visible, and false otherwise.
See also:
Theme_IsReadOnly()

std::string SUTheme::GetName (  )  [inline]

Queries ShapeUp for the name of this theme.

Returns:
The name of this theme.
See also:
Theme_GetName()

void SUTheme::SetName ( const char *  name  )  [inline]

Sets a new name for this theme.

Parameters:
name is a null-terminated string containing the new name for this theme.
See also:
Theme_SetName()

size_t SUTheme::GetAttributeCount (  )  [inline]

Queries ShapeUp for the number of attributes this theme has.

Returns:
The number of attributes.
See also:
Theme_GetAttributeCount()

std::string SUTheme::GetAttributeName ( size_t  column  )  [inline]

Queries ShapeUp for the name of this themes attributes.

Parameters:
column is the zero-based index of the attribute.
Returns:
The name of attribute at index column.
See also:
Theme_GetAttributeName()

unsigned long SUTheme::GetAttributeType ( size_t  column  )  [inline]

Queries ShapeUp for the type of this themes attributes.

Parameters:
column is the zero-based index of the attribute.
Returns:
The attribute type of attribute at index column.
See also:
ATTRIBUTETYPE, Theme_GetAttributeType()

size_t SUTheme::GetAttributeIndex ( const char *  name  )  [inline]

Queries ShapeUp for the index of a named attribute in this theme.

Parameters:
name is the name of the attribute to look up.
Returns:
The index of the named attribute. Throws an exception if the look-up failed.
See also:
ATTRIBUTETYPE, Theme_GetAttributeIndex()

size_t SUTheme::GetShapeCount (  )  [inline]

Queries ShapeUp for the number of shapes this theme has.

Returns:
The number of shapes in this theme.
See also:
Theme_GetShapeCount()

SUShape SUTheme::GetShape ( size_t  index  )  [inline]

Queries ShapeUp for a shape of this theme.

Parameters:
index is the zero-based index of the shape in this theme.
Returns:
The SUShape object at the given index.
See also:
Theme_GetShape()

SUShape SUTheme::GetShapeFromIndex ( size_t  index  )  [inline]

Queries ShapeUp for a shape of this theme.

Parameters:
index is the shape index of the shape in this theme.
Returns:
The SUShape object with the given index.
See also:
Theme_GetShape()

ShapeType SUTheme::GetShapeType (  )  [inline]

Queries ShapeUp for the shape type of this theme.

Returns:
The ShapeType of this theme.
See also:
Theme_GetShapeType()

void SUTheme::GetBounds ( SURectf r  )  [inline]

Gets the layers bounding box.

Parameters:
r [out] is a rectangle that will receive the shape bounds.
See also:
Theme_GetBounds()

void SUTheme::RecalcBounds (  )  [inline]

Call this function to recalculate the layers bounding box after its data has been manipulated.

See also:
SUTheme::ReplaceShapeData()

SURecordset SUTheme::GetIntersectingShapes ( SUShape  shape  )  [inline]

Queries ShapeUp for the shapes in this theme that intersects the shape argument. If the shape argument is taken from this theme, it is excluded from the resulting recordset. It's important to close the resulting recordset using SURecordset::Close() to avoid resource leaks.

Parameters:
shape is a shape to compare this theme's shapes to to find intersections.
Returns:
A recordset containing shapes.
See also:
SURecordset, Theme_GetIntersectingShapes()

SURecordset SUTheme::GetShapesInRect ( const SURectf r,
bool  bPartiallyInRectOk 
) [inline]

Queries ShapeUp for the shapes in a given rectangle in this theme. It's important to close the resulting recordset using SURecordset::Close() to avoid resource leaks.

Parameters:
r is a rectangle to compare this theme's shapes to to find intersections.
bPartiallyInRectOk if true, this function returns shapes intersecting the rectangle r. If false, only shapes fully contained in the rectangle r is returned.
Returns:
A recordset containing shapes.
See also:
SURecordset, Theme_GetShapesInRect()

size_t SUTheme::GetSelectionCount (  )  [inline]

Returns the number of selected objects in this theme.

Returns:
The number of selected objects.
See also:
Theme_GetSelectionCount()

SURecordset SUTheme::GetSelectedShapes (  )  [inline]

Queries ShapeUp for the selected shapes in this theme. It's important to close the resulting recordset using SURecordset::Close() to avoid resource leaks.

Returns:
A recordset containing shapes.
See also:
SURecordset, Theme_GetSelectedShapes()

SURecordset SUTheme::GetSelectedShapesInRect ( const SURectf r,
bool  bPartiallyInRectOk 
) [inline]

Queries ShapeUp for the selected shapes in a given rectangle in this theme. It's important to close the resulting recordset using SURecordset::Close() to avoid resource leaks.

Parameters:
r is a rectangle to compare this theme's shapes to to find intersections.
bPartiallyInRectOk if true, this function returns selected shapes intersecting the rectangle r. If false, only selected shapes fully contained in the rectangle r is returned.
Returns:
A recordset containing shapes.
See also:
SURecordset, Theme_GetSelectedShapesInRect()

std::string SUTheme::GetInfoTip ( SUShape  shape  )  [inline]

Gets the InfoTip of a shape in the theme. The InfoTip is translated from the themes InfoTip Template using attributes of the shape.

Parameters:
shape is the shape for which the InfoTip should be retrieved.
Returns:
The translated InfoTip for the SUShape shape.
See also:
SUShape, Theme_GetInfoTip()

void SUTheme::GetFont ( LOGFONT *  font,
COLORREF *  clr 
) [inline]

Gets font information for this theme.

Parameters:
font is a pointer to a LOGFONT struct that will receive the font information. May be NULL if not required.
clr is a pointer to a COLORREF value that will receive the text color information. May be NULL if not required.
See also:
GetFont()

SURecordset SUTheme::GetShapesByQuery ( const char *  where  )  [inline]

Queries ShapeUp for the shapes matching a query string in this theme. It's important to close the resulting recordset using SURecordset::Close() to avoid resource leaks.

Parameters:
where is an SQL where-statement as found in the ShapeUp Query dialog.
Returns:
A recordset containing shapes.
See also:
SURecordset, Theme_GetShapesByQuery()

SUHANDLE SUTheme::LookupWorkspace (  )  [inline]

Queries this theme for its parent workspace.

Returns:
A handle to a ShapeUp workspace.
See also:
Theme_LookupWorkspace()

size_t SUTheme::AddAttribute ( unsigned long  type,
const char *  name,
const char *  defaultval = NULL 
) [inline]

Adds an attribute to this theme.

Parameters:
type is an ATTRIBUTETYPE value indicating the type of the attribute.
name is a null-terminated string containing the name of the new attribute. This value may not be NULL nor an empty string.
defaultval is a null-terminated string containing an optional default value to be added to all shapes. This parameter may be NULL.
Returns:
The index of the created attribute.
See also:
ATTRIBUTETYPE, DeleteAttribute(), Theme_AddAttribute()
Examples:
example_loadergpi.cpp.

void SUTheme::DeleteAttribute ( size_t  index  )  [inline]

Deletes an attribute from this theme.

Parameters:
index is the zero-based index of the attribute.
See also:
AddAttribute(), Theme_DeleteAttribute()

void SUTheme::SetAttributeComment ( size_t  index,
const char *  comment 
) [inline]

Sets the comment for an attribute.

Parameters:
index is the zero-based index of the attribute.
comment is the new attribute comment. Use NULL to clear the comment.
See also:
Theme_SetAttributeComment()

std::string SUTheme::GetComment (  )  [inline]

Gets the theme comment.

Returns:
The theme comment.
See also:
Theme_GetComment()

void SUTheme::SetComment ( const char *  comment  )  [inline]

Sets the theme comment.

Parameters:
comment is the new theme comment.
See also:
Theme_SetComment()

COLORREF SUTheme::GetPenColor (  )  [inline]

Gets the theme's pen color.

Returns:
The theme's pen color.
See also:
Theme_GetPenColor()

void SUTheme::SetPenColor ( COLORREF  clr  )  [inline]

Sets the theme's pen color.

Parameters:
clr is the theme's new pen color.
See also:
Theme_SetPenColor()

COLORREF SUTheme::GetFillColor (  )  [inline]

Gets the theme's fill color.

Returns:
The theme's pen color.
See also:
Theme_GetFillColor()

void SUTheme::SetFillColor ( COLORREF  clr  )  [inline]

Sets the theme's fill color.

Parameters:
clr is the theme's new pen color.
See also:
Theme_SetFillColor()

size_t SUTheme::GetPenWidth (  )  [inline]

Gets the theme's pen width.

Returns:
The theme's pen width.
See also:
Theme_GetPenWidth()

void SUTheme::SetPenWidth ( size_t  width  )  [inline]

Sets the theme's pen width.

Parameters:
width is the theme's new pen width.
See also:
Theme_SetPenWidth()

size_t SUTheme::GetPenStyle (  )  [inline]

Gets the theme's pen style.

Returns:
The theme's pen style. For a list of possible style values see PENSTYLE.
See also:
Theme_GetPenStyle(), PENSTYLE

void SUTheme::SetPenStyle ( size_t  style  )  [inline]

Sets the theme's pen style.

Parameters:
style is the theme's new pen style. For a list of possible style values see PENSTYLE.
See also:
Theme_SetPenStyle(), PENSTYLE

void SUTheme::SetRasterImage ( HBITMAP  hbm,
double  west,
double  south,
double  east,
double  north,
const char *  sourceHint 
) [inline]

Sets the theme's pen width.

Parameters:
hbm is a handle to a Windows bitmap. ShapeUp will take ownership of the bitmap and destroy it when its no longer needed.
west is the western boudary of the raster.
south is the southern boudary of the raster.
east is the eastern boudary of the raster.
north is the northern boudary of the raster.
sourceHint is a description of where the data came from. E.g. if loaded from a file, this could be the file name. This parameter is informational only, and may be NULL. If supplied, it is displayed in the ShapeUp statistical view.
See also:
Theme_SetRasterImage()

void SUTheme::SetSerialData ( size_t  byteCount,
const void *  bytes 
) [inline]

Sets data to be serialized with a theme. This function can be called at any time setting new data. However, when this function is called, any old data is discarded and fully replaced with the new.
This data can later be restored from a ShapeUp workspace file when it is loaded, if the plug-in has set up a deserialize hook using the ShapeUp_AddDeserializeHook call.

Parameters:
byteCount is the size of the bytes array.
bytes is a pointer to a byte sequence containing the data to be serialized.
See also:
Theme_SetSerialData()

void SUTheme::ClearSelection (  )  [inline]

Clears the current shape selection in a theme.

See also:
Theme_ClearSelection()

void SUTheme::Select ( bool  select  )  [inline]

Clears the current shape selection in a theme.

Parameters:
select is true if selecting and false if deselecting.
See also:
Theme_Select()

void SUTheme::InvertSelection (  )  [inline]

Inverts the current shape selection in this theme.

See also:
Theme_InvertSelection()


The documentation for this class was generated from the following file:
Generated on Thu Apr 15 10:55:35 2010 for ShapeUp API by  doxygen 1.5.2