几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】display and odgscontainernode spatialinde (http://www.dimcax.com/hust/showthread.php?t=15742)

yang686526 2009-05-04 07:49 PM

【转帖】display and odgscontainernode spatialinde
 
display and odgscontainernode spatialindex
display and odgscontainernode spatialindex
hi,
i'm trying to do my own partial update. (so odgsbasevectorizedevice::supportpartialupdate return false);
in my application i have overrided odgsbasevectorizeview::display method, but it generates some memory leaks in dd_spatialindex.dll.
i think i have missed some important issues.
could you give me the code for odgsbasevectorizeview::display method ?
thanks for your help.

hi,
quote:
could you give me the code for odgsbasevectorizeview::display method ?
code:
void odgsbasevectorizeview::display(bool bupdate)
{
for(unsigned int i = 0; i < m_drawables.size(); ++i)
{
drawableholder& holder = m_drawables[i];
odgsnode* pnode = getrootnode(holder);
if(pnode)
{
odsavestate<oduint32> save_m_flags(m_flags);
setbit(m_flags, kdrawlayeroff, true);
setbit(m_flags, kmodelcache, true);
odsavestate<odgsbasemodel*> currgsmodel(m_pgsmodel, pnode->basemodel());
_override_rendermode ovrm(this, m_pgsmodel->rendermodeoverride());
if(bupdate)
pnode->update(*this, 0);
pnode->display(*this);
}
else // no model cache
{
setbit(m_flags, kmodelcache, false);
if(holder.m_pmetafile.get())
{
playmetafile(holder.m_pmetafile);
holder.m_pmetafile.release();
}
else
{
draw(drawableat(holder));
}
}
}
thank you mery much for your answers.
hi,
my problem seems to be in odgscontainernode::display, instead of pnode->display(*this); i use my own recurseplay(pnode) :
void exgsdirectxview::recurseplay(odgsnode * pnode)
{
if (pnode==null)
return;
odgsentitynode * pentnode = null;
if (pnode->iskindof(odgsentitynode::desc()))
{
pentnode = static_cast<odgsentitynode*>(pnode);
}
else if (pnode->iskindof(odgscontainernode::desc()))
{
odgscontainernode * pcontnode = static_cast<odgscontainernode*>(pnode);
pentnode = pcontnode->m_pfirstentity;
}
while(pentnode)
{
if (pentnode->hasextents() &&
m_bbox.intersects(pentnode->extents()))
{
pentnode->display(*this);
}
pentnode = pentnode->nextentity();
}
}
so could you give me the code for odgscontainernode::display method ?
thanks for your help.

i see you do not use odgscontainernode::display. practically it simply call's query to spatial index, if spatial index enabled.
it not contain any code coupled with memory leaks. may be real problem comes from container nodes cleaning?
thank you for your help. i know where to look now

hi,
btw, we introduce new functionality in 2.7, which can help in realtime objects and subobjects culling, instead spatial index. i think this information can be helpful for your case. culling volumes works separately from spatial index. set of culling volume classes completely supports orthogonal and perspective projections, projection transforms and some useable primitive types (aabb's (axis alligned bounding boxes), bounding spheres and obb's (oriented bounding boxes)). all functions placed into odgsbasevectorizeview, so can be used in any vectorization or export device. some functions are virtual, so can be overrided for any user case.
code:
// primitives culling routines
virtual void initcullingvolume();
void setcullingvolume(odgscullingvolumeptr newvol);
odgscullingvolumeptr cullingvolume() const;
virtual bool iscullingvolumeinitialized() const;
virtual bool cullingvolumeintersectwithopt(const odgscullingprimitive &prim) const;
virtual odgscullingvolume::intersectionstatus cullingvolumeintersectwith(const odgscullingprimitive &prim) const;
virtual void cullingvolumetransformby(const odgematrix3d &xfm);default implementation sets culling volume on overall view, and transforms it into all viewports. this behaviour used for optimize entities displaying in viewports, because only visible entities are displayed.
culling can be used simply like in this example:
code:
odgscullingbbox aabb;
if (pentitynode->extents(&view, aabb))
{
if (!view.cullingvolumeintersectwithopt(aabb))
return;


所有的时间均为北京时间。 现在的时间是 01:02 PM.