[Igarden-commit] Garden/source/LayoutDB Layer.cpp, 1.21.2.1, 1.21.2.2 Layer.h, 1.17.2.1, 1.17.2.2
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2007-01-28 23:28:22
|
Update of /cvsroot/igarden/Garden/source/LayoutDB In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv20649 Modified Files: Tag: Release_branch_v1 Layer.cpp Layer.h Log Message: Enforce ordering of different types of elements Index: Layer.cpp =================================================================== RCS file: /cvsroot/igarden/Garden/source/LayoutDB/Layer.cpp,v retrieving revision 1.21.2.1 retrieving revision 1.21.2.2 diff -C2 -d -r1.21.2.1 -r1.21.2.2 *** Layer.cpp 15 Nov 2006 03:59:06 -0000 1.21.2.1 --- Layer.cpp 28 Jan 2007 23:28:19 -0000 1.21.2.2 *************** *** 55,60 **** { PRECONDITION(this != NULL); ! PRECONDITION(_root != NULL); ! _root->AddToMaterialArray(list, uid); } --- 55,63 ---- { PRECONDITION(this != NULL); ! ! short i, count; ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! _roots[i]->AddToMaterialArray(list, uid); } *************** *** 62,67 **** { PRECONDITION(this != NULL); ! PRECONDITION(_root != NULL); ! _root->AddToReferenceArray(list, uid); } --- 65,73 ---- { PRECONDITION(this != NULL); ! ! short i, count; ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! _roots[i]->AddToReferenceArray(list, uid); } *************** *** 76,79 **** --- 82,87 ---- Layer::Layer( DatabaseFile* file, const char* cid, Layout* layout, UInt32 layerNum ) { + short i; + _compat = new DBPersist(file, cid, layerNum); _isEnabled = true; *************** *** 90,99 **** _elementBounds.ySize = 0; _uid = gNilUID; - _root = new BSPNode(_bounds); _layerDBIndex = layerNum; } Layer::Layer( Layout* layout, UInt32 layerNum ) { _compat = NULL; _isEnabled = true; --- 98,113 ---- _elementBounds.ySize = 0; _uid = gNilUID; _layerDBIndex = layerNum; + + for(i=0; i < kNumOrderEntries; i++) + { + _roots.push_back(new BSPNode(_bounds)); + } } Layer::Layer( Layout* layout, UInt32 layerNum ) { + short i; + _compat = NULL; _isEnabled = true; *************** *** 110,116 **** _elementBounds.ySize = 0; _uid = gNilUID; - _root = new BSPNode(_bounds); _layerDBIndex = layerNum; _layout = layout; } --- 124,133 ---- _elementBounds.ySize = 0; _uid = gNilUID; _layerDBIndex = layerNum; _layout = layout; + for(i=0; i < kNumOrderEntries; i++) + { + _roots.push_back(new BSPNode(_bounds)); + } } *************** *** 124,128 **** Layer::~Layer() { ! delete _root; } --- 141,150 ---- Layer::~Layer() { ! short i; ! ! for(i=_roots.Length()-1; i >= 0; i--) ! { ! delete _roots[i]; ! } } *************** *** 135,139 **** PRECONDITION(this != NULL); PRECONDITION(obj != NULL); - PRECONDITION(_root != NULL); // <Layer Enabled="yes" UID="bd6a.5f01.8.8adc" YSize="500" XSize="500"/> dataObj = dynamic_cast<XGXMLData*>(obj); --- 157,160 ---- *************** *** 169,178 **** void Layer::OffsetPoints(planPoint_t offset) { _bounds.xOffset += offset.xOffset; _bounds.yOffset += offset.yOffset; _elementBounds.xOffset += offset.xOffset; _elementBounds.yOffset += offset.yOffset; ! ! _root->MoveAllElements(offset); } --- 190,204 ---- void Layer::OffsetPoints(planPoint_t offset) { + PRECONDITION(this != NULL); + _bounds.xOffset += offset.xOffset; _bounds.yOffset += offset.yOffset; _elementBounds.xOffset += offset.xOffset; _elementBounds.yOffset += offset.yOffset; ! ! short i, count; ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! _roots[i]->MoveAllElements(offset); } *************** *** 189,196 **** PRECONDITION(this != NULL); PRECONDITION(view != NULL); - PRECONDITION(_root != NULL); if(_isEnabled && view->IntersectsUpdateRegion(_bounds)) { ! _root->Draw(view, _bounds); } } --- 215,225 ---- PRECONDITION(this != NULL); PRECONDITION(view != NULL); if(_isEnabled && view->IntersectsUpdateRegion(_bounds)) { ! short i, count; ! ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! _roots[i]->Draw(view, _bounds); } } *************** *** 206,216 **** { planRectangle_t elBound; PRECONDITION(this != NULL); PRECONDITION(item != NULL); - PRECONDITION(_root != NULL); item->SetLayer(this); elBound = item->GetBoundingRectangle(); ! _root->Add(item); ItemBoundRectChanged(elBound); --- 235,252 ---- { planRectangle_t elBound; + displayOrder_t order; PRECONDITION(this != NULL); PRECONDITION(item != NULL); item->SetLayer(this); elBound = item->GetBoundingRectangle(); ! ! order = item->GetDisplayOrder(); ! if(order < 0) ! order = static_cast<displayOrder_t>(0); ! else if(order >= kNumOrderEntries) ! order = static_cast<displayOrder_t>(kNumOrderEntries-1); ! ! _roots[order]->Add(item); ItemBoundRectChanged(elBound); *************** *** 232,237 **** PRECONDITION(this != NULL); PRECONDITION(item != NULL); ! PRECONDITION(_root != NULL); ! _root->RemoveElement(item); item->ClearLayer(); SetModified(); --- 268,276 ---- PRECONDITION(this != NULL); PRECONDITION(item != NULL); ! ! short i, count; ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! _roots[i]->RemoveElement(item); item->ClearLayer(); SetModified(); *************** *** 249,255 **** PRECONDITION(this != NULL); PRECONDITION(item != NULL); ! PRECONDITION(_root != NULL); ! if(!_root->MoveElement(fromRect, toRect, item)) ! ItemBoundRectChanged(toRect); // If not changed bucket, might still need to grow rect SetModified(); } --- 288,302 ---- PRECONDITION(this != NULL); PRECONDITION(item != NULL); ! ! short i, count; ! bool moved = false; ! count = _roots.Length(); ! for(i = 0; i < count && !moved; i++) ! { ! if(_roots[i]->MoveElement(fromRect, toRect, item)) ! moved = true; ! else ! ItemBoundRectChanged(toRect); // If not changed bucket, might still need to grow rect ! } SetModified(); } *************** *** 265,268 **** --- 312,316 ---- { Int32 n, numItems; + short i, count; Element *item; short revision, enableFlag; *************** *** 272,278 **** UInt32 debugDepth, debugMaxLoad, bufLength; char *buf; PRECONDITION(this != NULL); - PRECONDITION(_root != NULL); PRECONDITION(_layout != NULL); PRECONDITION(_compat != NULL); --- 320,326 ---- UInt32 debugDepth, debugMaxLoad, bufLength; char *buf; + displayOrder_t order; PRECONDITION(this != NULL); PRECONDITION(_layout != NULL); PRECONDITION(_compat != NULL); *************** *** 283,287 **** _compat->GetBuf(kFieldLayerData, bufLength, buf); stream = new BufStream(buf, bufLength); ! _root->RemoveAllItems(); revision = stream->ReadSInt16(); --- 331,338 ---- _compat->GetBuf(kFieldLayerData, bufLength, buf); stream = new BufStream(buf, bufLength); ! ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! _roots[i]->RemoveAllItems(); revision = stream->ReadSInt16(); *************** *** 297,301 **** MyAssert(item != NULL); item->SetLayer(this); ! _root->Add(item); elemRect = item->GetBoundingRectangle(); --- 348,358 ---- MyAssert(item != NULL); item->SetLayer(this); ! order = item->GetDisplayOrder(); ! if(order < 0) ! order = static_cast<displayOrder_t>(0); ! else if(order >= kNumOrderEntries) ! order = static_cast<displayOrder_t>(kNumOrderEntries-1); ! ! _roots[order]->Add(item); elemRect = item->GetBoundingRectangle(); *************** *** 316,321 **** } ! debugDepth = _root->Depth(); ! debugMaxLoad = _root->MaximumLoading(); _isModified = false; --- 373,378 ---- } ! // debugDepth = _root->Depth(); ! // debugMaxLoad = _root->MaximumLoading(); _isModified = false; *************** *** 327,331 **** { PRECONDITION(this != NULL); ! PRECONDITION(_root != NULL); writer.WriteStartTag("Layer"); writer.WriteStartTagBoolArg("Enabled", _isEnabled); --- 384,388 ---- { PRECONDITION(this != NULL); ! writer.WriteStartTag("Layer"); writer.WriteStartTagBoolArg("Enabled", _isEnabled); *************** *** 334,338 **** writer.WriteStartTagArg("YSize", (long)_bounds.ySize); writer.WriteStartTagArg("XSize", (long)_bounds.xSize); ! _root->SaveAsXML(writer); writer.WriteEndTag(); } --- 391,399 ---- writer.WriteStartTagArg("YSize", (long)_bounds.ySize); writer.WriteStartTagArg("XSize", (long)_bounds.xSize); ! ! short i, count; ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! _roots[i]->SaveAsXML(writer); writer.WriteEndTag(); } *************** *** 539,544 **** { PRECONDITION(this != NULL); ! PRECONDITION(_root != NULL); ! return _root->AddToSelect(within, selected, view); } // --------------------------------------------------------------------------- --- 600,611 ---- { PRECONDITION(this != NULL); ! ! short i, count; ! bool result = false; ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! result |= _roots[i]->AddToSelect(within, selected, view); ! ! return result; } // --------------------------------------------------------------------------- *************** *** 552,557 **** { PRECONDITION(this != NULL); ! PRECONDITION(_root != NULL); ! _root->ToggleSelect(within, selected, view); } // --------------------------------------------------------------------------- --- 619,627 ---- { PRECONDITION(this != NULL); ! ! short i, count; ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! _roots[i]->ToggleSelect(within, selected, view); } // --------------------------------------------------------------------------- *************** *** 566,573 **** PRECONDITION(this != NULL); PRECONDITION(testElement != NULL); - PRECONDITION(_root != NULL); planRectangle_t rect = testElement->GetBoundingRectangle(); ! return _root->TestOverlap(testElement, action, rect); } --- 636,649 ---- PRECONDITION(this != NULL); PRECONDITION(testElement != NULL); planRectangle_t rect = testElement->GetBoundingRectangle(); ! short i, count; ! bool result = false; ! ! count = _roots.Length(); ! for(i = 0; i < count && !result; i++) ! result = _roots[i]->TestOverlap(testElement, action, rect); ! ! return result; } *************** *** 580,585 **** { PRECONDITION(this != NULL); ! PRECONDITION(_root != NULL); ! return _root->GetElementsAtPoint(point, view, results); } --- 656,667 ---- { PRECONDITION(this != NULL); ! ! short i, count; ! bool result = false; ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! result |= _roots[i]->GetElementsAtPoint(point, view, results); ! ! return result; } *************** *** 589,594 **** { PRECONDITION(this != NULL); ! PRECONDITION(_root != NULL); ! _root->ExecuteForEachElementWithin(callback, ref, clipRect); } --- 671,679 ---- { PRECONDITION(this != NULL); ! ! short i, count; ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! _roots[i]->ExecuteForEachElementWithin(callback, ref, clipRect); } *************** *** 603,608 **** { PRECONDITION(this != NULL); ! PRECONDITION(_root != NULL); ! _root->PutInDatabasePanel(panel); } // --------------------------------------------------------------------------- --- 688,696 ---- { PRECONDITION(this != NULL); ! ! short i, count; ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! _roots[i]->PutInDatabasePanel(panel); } // --------------------------------------------------------------------------- *************** *** 676,681 **** { PRECONDITION(this != NULL); ! PRECONDITION(_root != NULL); ! return _root->FindMaterial(materialID); } // --------------------------------------------------------------------------- --- 764,775 ---- { PRECONDITION(this != NULL); ! ! short i, count; ! MaterialRef *result = NULL; ! count = _roots.Length(); ! for(i = 0; i < count && result == NULL; i++) ! result = _roots[i]->FindMaterial(materialID); ! ! return result; } // --------------------------------------------------------------------------- *************** *** 712,719 **** PRECONDITION(toLayer != NULL); PRECONDITION(this != NULL); - PRECONDITION(_root != NULL); - toLayer->_root = _root->Duplicate(toLayer); ! POSTCONDITION(toLayer->_root != NULL); } --- 806,817 ---- PRECONDITION(toLayer != NULL); PRECONDITION(this != NULL); ! short i, count; ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! toLayer->_roots[i] = _roots[i]->Duplicate(toLayer); ! ! for(i = 0; i < count; i++) ! POSTCONDITION(toLayer->_roots[i] != NULL); } *************** *** 721,728 **** void Layer::ExtractMaterialReferences(ClientDocument *doc) ! { PRECONDITION(this != NULL); ! PRECONDITION(_root != NULL); ! _root->ExtractMaterialReferences(doc); } --- 819,829 ---- void Layer::ExtractMaterialReferences(ClientDocument *doc) ! { PRECONDITION(this != NULL); ! ! short i, count; ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! _roots[i]->ExtractMaterialReferences(doc); } *************** *** 730,735 **** { PRECONDITION(this != NULL); ! PRECONDITION(_root != NULL); _bounds.yOffset = maxHeight - _bounds.ySize; - _root->ConvertToOpenGLCoordinates(maxHeight); } \ No newline at end of file --- 831,839 ---- { PRECONDITION(this != NULL); ! ! short i, count; ! count = _roots.Length(); ! for(i = 0; i < count; i++) ! _roots[i]->ConvertToOpenGLCoordinates(maxHeight); _bounds.yOffset = maxHeight - _bounds.ySize; } \ No newline at end of file Index: Layer.h =================================================================== RCS file: /cvsroot/igarden/Garden/source/LayoutDB/Layer.h,v retrieving revision 1.17.2.1 retrieving revision 1.17.2.2 diff -C2 -d -r1.17.2.1 -r1.17.2.2 *** Layer.h 15 Nov 2006 03:59:06 -0000 1.17.2.1 --- Layer.h 28 Jan 2007 23:28:19 -0000 1.17.2.2 *************** *** 116,120 **** planRectangle_t _bounds; planRectangle_t _elementBounds; ! BSPNode* _root; rsuid_t _uid; --- 116,120 ---- planRectangle_t _bounds; planRectangle_t _elementBounds; ! XGDynArray<BSPNode*> _roots; rsuid_t _uid; |