Files
Slnkdwf/SlnkDWFImpl/EplotSectionsImpl.cpp
Jos Groot Lipman 6596ce32c5 TUDE#13285 AsDWF Schaal behouden
svn path=/Slnkdwf/trunk/; revision=12484
2007-12-19 09:44:56 +00:00

79 lines
1.7 KiB
C++

// EPlotSections.cpp : Implementation of CEPlotSections
#include "stdafx.h"
#include "EPlotSectionsImpl.h"
// CEPlotSections
CEPlotSectionsImpl::~CEPlotSectionsImpl()
{
for (size_t i=0; i<m_EPlotSections.GetCount(); i++)
delete m_EPlotSections[i];
}
BOOL CEPlotSectionsImpl::Add(CEPlotSectionImpl *pSection)
{
m_EPlotSections.Add(pSection);
return true;
}
// Actually process the EPlotSections and add them to our collection
BOOL CEPlotSectionsImpl::ProcessManifest(DWFManifest& rManifest, CString sourceDescription)
{
//
// obtain the ePlot section
//
DWFManifest::SectionIterator* piSections =
rManifest.findSectionsByType( _DWF_FORMAT_EPLOT_TYPE_WIDE_STRING );
//
// make sure we got a section
//
if ((piSections == NULL) || (piSections->valid() == false))
{
if (piSections)
{
DWFCORE_FREE_OBJECT( piSections );
}
myTRACE("%ls", L"Malformed or unexpected 3D DWF, cannot continue without an EPlot section");
return FALSE;
}
//
// get the EPlot Section
//
int page=0;
while (piSections->valid())
{
DWFEPlotSection* pSection =
dynamic_cast<DWFEPlotSection*>(piSections->get());
CEPlotSectionImpl *mySection = new CEPlotSectionImpl;
CString s;s.Format("%s (page %d)", sourceDescription, page++);
mySection->Init(pSection, s);
m_EPlotSections.Add(mySection);
piSections->next();
}
//
// done with the iterator
//
DWFCORE_FREE_OBJECT( piSections );
return TRUE;
}
long CEPlotSectionsImpl::get_Count()
{
return (LONG)m_EPlotSections.GetCount();
}
CEPlotSectionImpl *CEPlotSectionsImpl::get_Item(LONG i)
{
if (i<0 || i>=(LONG)m_EPlotSections.GetCount())
return NULL;
return (m_EPlotSections.GetAt(i));
}