#include <epsfiltr.h>
Inheritance diagram for RangeList:
Public Member Functions | |
BOOL | AddRange (Node *pFirst, Node *pLast) |
Adds another range to the range list. All nodes from pFirst to pLast are inclusively added to the range. | |
DocRect | GetBoundingRect () |
Goes through all nodes in all the ranges in this RangeList, and unions all the bounding boxes together. It uses the simple algorithm, which does not take account of the attributes applied to the nodes - i.e. it only gives an approximation (hence this function can result in bounding boxes being in the tree which are not entirely accurate). | |
void | Transform (TransformBase &) |
Transforms all the nodes in all the ranges of this range list using the transform object given. | |
Private Member Functions | |
CC_DECLARE_MEMDUMP (RangeList) |
Definition at line 302 of file epsfiltr.h.
|
Adds another range to the range list. All nodes from pFirst to pLast are inclusively added to the range.
Definition at line 249 of file epsfiltr.cpp. 00250 { 00251 // Get a new range 00252 RangeListItem *pItem = new RangeListItem(pFirst, pLast); 00253 if (pItem == NULL) 00254 // Out of memory 00255 return FALSE; 00256 00257 // Add it to the list and return success 00258 AddTail(pItem); 00259 return TRUE; 00260 }
|
|
|
|
Goes through all nodes in all the ranges in this RangeList, and unions all the bounding boxes together. It uses the simple algorithm, which does not take account of the attributes applied to the nodes - i.e. it only gives an approximation (hence this function can result in bounding boxes being in the tree which are not entirely accurate).
Definition at line 278 of file epsfiltr.cpp. 00279 { 00280 // Start off with empty rectangle 00281 DocRect RangeBBox; 00282 00283 // Do each range in turn 00284 RangeListItem *pItem = (RangeListItem *) GetHead(); 00285 00286 while (pItem != NULL) 00287 { 00288 // Do each node in turn 00289 if(pItem->IsLayer) 00290 { 00291 // layer based calcuations 00292 00293 // see long note below 00294 RangeBBox = RangeBBox.Union(pItem->TheLayer->GetBoundingRect(TRUE)); 00295 } 00296 else 00297 { 00298 // range based calculations 00299 Node *pNode = pItem->TheRange.FindFirst(); 00300 00301 while (pNode != NULL) 00302 { 00303 // Does this node have a bounding rectangle? 00304 if (pNode->IsBounded()) 00305 { 00306 // Yes - add it to our union 00307 NodeRenderableBounded *pNodeBounded = (NodeRenderableBounded *) pNode; 00308 00309 // Pass in TRUE so that we don't do a 'proper' attribute scan for the 00310 // bounding box - we only need an approximate bounding rectangle 00311 // for centering it anyway. 00312 // NB. this results in inaccurate bounding boxes in the tree, but when 00313 // we call this we're about to transform them anyway, so they'll 00314 // be updated correctly afterwards. 00315 RangeBBox = RangeBBox.Union(pNodeBounded->GetBoundingRect(TRUE)); 00316 } 00317 else 00318 { 00319 ENSURE(FALSE, "Found a non-renderable node in the import range"); 00320 } 00321 00322 // Try the next node. 00323 pNode = pItem->TheRange.FindNext(pNode); 00324 } 00325 } 00326 00327 // Try the next range 00328 pItem = (RangeListItem *) GetNext(pItem); 00329 } 00330 00331 // Return the accumulated bounds 00332 return RangeBBox; 00333 }
|
|
Transforms all the nodes in all the ranges of this range list using the transform object given.
Definition at line 348 of file epsfiltr.cpp. 00349 { 00350 // Do each range in turn 00351 RangeListItem *pItem = (RangeListItem *) GetHead(); 00352 00353 while (pItem != NULL) 00354 { 00355 if(pItem->IsLayer) 00356 { 00357 pItem->TheLayer->Transform(Trans); 00358 } 00359 else 00360 { 00361 // Transform all nodes in this range 00362 Node *pNode = pItem->TheRange.FindFirst(); 00363 00364 while (pNode != NULL) 00365 { 00366 // Is this node renderable? 00367 if (pNode->IS_KIND_OF(NodeRenderable)) 00368 { 00369 // Yes - transform it. 00370 NodeRenderable *pNodeRenderable = (NodeRenderable *) pNode; 00371 pNodeRenderable->Transform(Trans); 00372 } 00373 else 00374 { 00375 ENSURE(FALSE, "Found a non-renderable node in the import range"); 00376 } 00377 00378 // Try the next node. 00379 pNode = pItem->TheRange.FindNext(pNode); 00380 } 00381 } 00382 00383 // Try the next range 00384 pItem = (RangeListItem *) GetNext(pItem); 00385 } 00386 }
|