Ejemplo n.º 1
0
void wxSFLayoutHorizontalTree::ProcessNode(wxSFShapeBase* node, double x)
{
	wxASSERT( node );
	
	if( node )
	{
		node->MoveTo( x, m_nMinY );
		
		wxRect rctBB = node->GetBoundingBox();
		if( rctBB.GetHeight() > m_nCurrMaxHeight ) m_nCurrMaxHeight = rctBB.GetHeight();
		
		ShapeList lstNeighbours;
		node->GetNeighbours( lstNeighbours, CLASSINFO(wxSFShapeBase), wxSFShapeBase::lineSTARTING );

		if( lstNeighbours.IsEmpty() )
		{
			m_nMinY += m_nCurrMaxHeight + m_VSpace;
		}
		else
		{
			for( ShapeList::iterator it = lstNeighbours.begin(); it != lstNeighbours.end(); ++it )
			{
				if( ! (*it)->GetParentShape() )	ProcessNode( *it, x + rctBB.GetWidth() + m_HSpace );
			}
		}
	}
}
Ejemplo n.º 2
0
void wxSFDiagramManager::GetAssignedConnections(wxSFShapeBase* parent, wxClassInfo* shapeInfo, wxSFShapeBase::CONNECTMODE mode, ShapeList& lines)
{
	wxSFLineShape* pLine;
	
	if( parent->GetId() == -1 ) return;

	SerializableList lstLines;
	// lines are children of root item only so we have not to search recursively...
	GetRootItem()->GetChildren( shapeInfo, lstLines );
	
	if( !lstLines.IsEmpty() )
    {
        SerializableList::compatibility_iterator node = lstLines.GetFirst();
        while(node)
        {
            pLine = (wxSFLineShape*)node->GetData();
            switch(mode)
            {
                case wxSFShapeBase::lineSTARTING:
                    if( pLine->GetSrcShapeId() == parent->GetId() ) lines.Append(pLine);
                    break;

                case wxSFShapeBase::lineENDING:
                    if( pLine->GetTrgShapeId() == parent->GetId() ) lines.Append(pLine);
                    break;

                case wxSFShapeBase::lineBOTH:
                    if( ( pLine->GetSrcShapeId() == parent->GetId() ) ||
					    ( pLine->GetTrgShapeId() == parent->GetId() ) ) lines.Append(pLine);
                    break;
            }
            node = node->GetNext();
        }
    }
}
Ejemplo n.º 3
0
void wxSFAutoLayout::Layout(wxSFDiagramManager& manager, const wxString& algname)
{
	wxSFLayoutAlgorithm *pAlg = m_mapAlgorithms[ algname ];
	if( pAlg )
	{
		ShapeList lstShapes;
		manager.GetShapes( CLASSINFO(wxSFShapeBase), lstShapes );
		
		// remove all child shapes
		ShapeList::compatibility_iterator it = lstShapes.GetFirst();
		while( it )
		{
			wxSFShapeBase *pShape = it->GetData();
			if( pShape->GetParentShape() || pShape->IsKindOf(CLASSINFO(wxSFLineShape)) )
			{
				lstShapes.DeleteNode( it );
				it = lstShapes.GetFirst();
			}
			else
				it = it->GetNext();
		}
		
		pAlg->DoLayout( lstShapes );
		
		manager.MoveShapesFromNegatives();
		
		if( manager.GetShapeCanvas() ) UpdateCanvas( manager.GetShapeCanvas() );
	}
}
Ejemplo n.º 4
0
void udStateChartOptimizer::FindTransWithIdenticalActions(ShapeList& transitions, ShapeList& sublist)
{
	sublist.Clear();

	ShapeList::compatibility_iterator node = transitions.GetFirst();
	if( !node ) return;

	udTransElementItem *pTransElement;
	wxSFLineShape *pTrans = (wxSFLineShape*)node->GetData();
	wxString sActions, sTemplate = ((udTransElementItem*)pTrans->GetUserData())->GetActionsString();
	sTemplate.Replace(wxT(" "), wxT(""));

	while(node)
	{
		pTrans = (wxSFLineShape*)node->GetData();
		pTransElement = (udTransElementItem*)pTrans->GetUserData();

		sActions = pTransElement->GetActionsString();
		sActions.Replace(wxT(" "), wxT(""));

		if( sActions == sTemplate )
		{
			node = node->GetNext();
			transitions.DeleteObject(pTrans);
			sublist.Append(pTrans);
		}
		else
			node = node->GetNext();
	}
}
Ejemplo n.º 5
0
void TableSettings::OnInit(wxInitDialogEvent& event)
{
    m_textName->SetValue( m_pTable->GetName() );

    // fill database data types
    wxArrayString* pDbTypes = m_pDbAdapter->GetDbTypes();
    if( pDbTypes ) {
        wxArrayString choices;
        for (unsigned int i = 0; i < pDbTypes->GetCount(); ++i) {
            choices.Add( pDbTypes->Item(i) );
        }

        m_dvColumns->DeleteColumn( m_dvColumns->GetColumn(1) );
        m_dvColumns->InsertColumn( 1, new wxDataViewColumn( _("Type"), new wxDataViewChoiceRenderer( choices, wxDATAVIEW_CELL_EDITABLE, wxDVR_DEFAULT_ALIGNMENT), 1, -2, wxALIGN_LEFT));

        pDbTypes->Clear();
        delete pDbTypes;
    }

    // fill referenced tables
    ShapeList tables;
    m_choiceRefTable->Append( wxT("") );
    m_pDiagramManager->GetShapes( CLASSINFO(ErdTable), tables );
    for( ShapeList::iterator it = tables.begin(); it != tables.end(); ++it ) {
        Table *t = (Table*) (*it)->GetUserData();
        if( t && t->GetName() != m_pTable->GetName() ) m_choiceRefTable->Append( t->GetName() );
    }

    UpdateView();

    event.Skip();
}
Ejemplo n.º 6
0
void wxSFLayoutMesh::DoLayout(ShapeList& shapes)
{
	int i = 0, cols = floor( sqrt( (float)shapes.GetCount() ) );
	
	double roffset, coffset, maxh = -m_HSpace;
	roffset = coffset = 0;

	wxRealPoint nStart = GetTopLeft( shapes );

	for( ShapeList::iterator it = shapes.begin(); it != shapes.end(); ++ it )
	{
		wxSFShapeBase *pShape = *it;
		
		if( i++ % cols == 0 )
		{
			coffset = 0;
			roffset += maxh + m_HSpace;
			maxh = 0;
		}
		
		pShape->MoveTo( nStart.x + coffset, nStart.y + roffset );
		
		wxRect rctBB = pShape->GetBoundingBox();
		coffset += rctBB.GetWidth() + m_VSpace;
		
		if( rctBB.GetHeight() > maxh ) maxh = rctBB.GetHeight();
	}
}
Ejemplo n.º 7
0
void DbViewerPanel::OnDnDStart(wxTreeEvent& event)
{
    ShapeList lstDnD;
    lstDnD.DeleteContents(true);
    DbItem* item = (DbItem*)m_treeDatabases->GetItemData(event.GetItem());

    ErdPanel* pPanel = wxDynamicCast(m_mgr->GetActivePage(), ErdPanel);

    if(item != NULL) {
        if(pPanel) {
            Table* table = wxDynamicCast(item->GetData(), Table);
            if(table) {
                table = (Table*)table->Clone();
                wxSFShapeBase* pShape = new dndTableShape(table);
                lstDnD.Append(pShape);
                pPanel->GetCanvas()->DoDragDrop(lstDnD);
            }

            View* view = wxDynamicCast(item->GetData(), View);
            if(view) {
                view = (View*)view->Clone();
                wxSFShapeBase* pShape = new dndTableShape(view);
                lstDnD.Append(pShape);
                pPanel->GetCanvas()->DoDragDrop(lstDnD);
            }
        }
    }
}
Ejemplo n.º 8
0
bool wxSFShapeBase::IsAncestor(wxSFShapeBase *child)
{
	ShapeList lstChildren;
	
	GetChildShapes( NULL, lstChildren, sfRECURSIVE );
	
	return ( lstChildren.IndexOf(child) != wxNOT_FOUND );	
}
Ejemplo n.º 9
0
bool wxSFShapeBase::IsDescendant(wxSFShapeBase *parent)
{
	ShapeList lstChildren;
	
	if( parent ) parent->GetChildShapes( NULL, lstChildren, sfRECURSIVE );
	
	return ( lstChildren.IndexOf(this) != wxNOT_FOUND );
}
Ejemplo n.º 10
0
void wxSFShapeBase::GetNeighbours(ShapeList& neighbours, wxClassInfo *shapeInfo, CONNECTMODE condir, bool direct)
{
    if( !this->IsKindOf(CLASSINFO(wxSFLineShape)) )
    {
        m_lstProcessed.Clear();
        this->_GetNeighbours(neighbours, shapeInfo, condir, direct);
        // delete starting object if necessary (can be added in a case of complex connection network)
        neighbours.DeleteObject(this);
    }
}
Ejemplo n.º 11
0
Table* TableSettings::GetRefTable(const wxString& name)
{
    ShapeList tables;
    m_pDiagramManager->GetShapes( CLASSINFO(ErdTable), tables );

    for( ShapeList::iterator it = tables.begin(); it != tables.end(); ++it ) {
        Table *t = (Table*) (*it)->GetUserData();
        if( t->GetName() == name ) return t;
    }

    return NULL;
}
Ejemplo n.º 12
0
bool DatabaseCanvas::IsTableDisplayed(const std::wstring &name)
{
    ShapeList listShapes;
    m_pManager.GetShapes( CLASSINFO( MyErdTable ), listShapes );
    bool found = false;
    for( ShapeList::iterator it = listShapes.begin(); it != listShapes.end() && !found; ++it )
    {
        if( dynamic_cast<MyErdTable *>( (*it) )->GetTableName() == name )
            found = true;
    }
    return found;
}
Ejemplo n.º 13
0
void shapeGroup::RefteshTotalData()
{
	ShapeList TMPShapeList = SG_ShapeData;

	ShapeList::iterator	SG_ShapeData_Iterator = TMPShapeList.begin();

	SG_Size = TMPShapeList.size();

	const int	VAOSize = SG_Size * 12;
	const int	ItemSize = SG_Size * 20;

	GLfloat*	SG_TmpTotalData = (GLfloat*)malloc(sizeof(GLfloat) * ItemSize);


	if (SG_TmpTotalData == nullptr)
	{
		std::cout << "[Warning]Can't malloc(" << sizeof(GLfloat) * ItemSize << ")" << std::endl;

		return;
	}

	//start to copy
	for (int LoopShapeNumber = 0; LoopShapeNumber < SG_Size; LoopShapeNumber++)
	{
		//VAO
		SG_TmpTotalData[LoopShapeNumber * 12 + 0] = SG_ShapeData_Iterator->Shape->VAO_Data[0] + SG_ShapeData_Iterator->Location[0];
		SG_TmpTotalData[LoopShapeNumber * 12 + 1] = SG_ShapeData_Iterator->Shape->VAO_Data[1] + SG_ShapeData_Iterator->Location[1];
		SG_TmpTotalData[LoopShapeNumber * 12 + 2] = SG_ShapeData_Iterator->Shape->VAO_Data[2] + SG_ShapeData_Iterator->Location[2];

		SG_TmpTotalData[LoopShapeNumber * 12 + 3] = SG_ShapeData_Iterator->Shape->VAO_Data[3] + SG_ShapeData_Iterator->Location[0];
		SG_TmpTotalData[LoopShapeNumber * 12 + 4] = SG_ShapeData_Iterator->Shape->VAO_Data[4] + SG_ShapeData_Iterator->Location[1];
		SG_TmpTotalData[LoopShapeNumber * 12 + 5] = SG_ShapeData_Iterator->Shape->VAO_Data[5] + SG_ShapeData_Iterator->Location[2];

		SG_TmpTotalData[LoopShapeNumber * 12 + 6] = SG_ShapeData_Iterator->Shape->VAO_Data[6] + SG_ShapeData_Iterator->Location[0];
		SG_TmpTotalData[LoopShapeNumber * 12 + 7] = SG_ShapeData_Iterator->Shape->VAO_Data[7] + SG_ShapeData_Iterator->Location[1];
		SG_TmpTotalData[LoopShapeNumber * 12 + 8] = SG_ShapeData_Iterator->Shape->VAO_Data[8] + SG_ShapeData_Iterator->Location[2];

		SG_TmpTotalData[LoopShapeNumber * 12 + 9] = SG_ShapeData_Iterator->Shape->VAO_Data[9] + SG_ShapeData_Iterator->Location[0];
		SG_TmpTotalData[LoopShapeNumber * 12 + 10] = SG_ShapeData_Iterator->Shape->VAO_Data[10] + SG_ShapeData_Iterator->Location[1];
		SG_TmpTotalData[LoopShapeNumber * 12 + 11] = SG_ShapeData_Iterator->Shape->VAO_Data[11] + SG_ShapeData_Iterator->Location[2];
		//TexturePos
		for (int i = 0; i < 8; i++)
		{
			SG_TmpTotalData[VAOSize + LoopShapeNumber * 8 + i] = SG_ShapeData_Iterator->Shape->TexturePos_Data[i];
		}
		SG_ShapeData_Iterator++;
	}
	SG_TotalData = SG_TmpTotalData;

	SG_NeedRefreshBuffer = true;
	SG_IsRefreshingData = false;
}
Ejemplo n.º 14
0
void Rectangle::saveRectangle(string fileName, ShapeList& s_list) // 파일 쓰기용
{
	ofstream fout;
	fout.open(fileName, ios_base::out);

	for (int i = 0; i < s_list.getCount(); i++)
	{
		Shape* s = s_list.getShapeList(i);
		s->print();
	}

	fout.close();
}
Ejemplo n.º 15
0
void udLoopCaseAlgorithm::ProcessState(wxSFShapeBase *state)
{
    wxASSERT(state);
    if(!state)return;

    // check whether the state is already processed
    if( m_lstProcessedElements.IndexOf(state) != wxNOT_FOUND )return;

    wxSFDiagramManager *pDiagManager = state->GetShapeManager();
	udLanguage *pLang = m_pParentGenerator->GetActiveLanguage();
	
	pLang->SingleLineCommentCmd(wxT("State ID: ") + m_pParentGenerator->MakeIDName(state));

    // find state neighbours
    ShapeList lstNeighbours;
    pDiagManager->GetNeighbours(state, lstNeighbours, CLASSINFO(umlTransitionItem), wxSFShapeBase::lineSTARTING, sfDIRECT);
	// find next processable state
    if( !lstNeighbours.IsEmpty() && ( m_lstProcessedElements.IndexOf(lstNeighbours.GetFirst()->GetData()) == wxNOT_FOUND ) )
    {
        m_pNextElement = lstNeighbours.GetFirst()->GetData();
    }
    else
        m_pNextElement = NULL;
	
    // process given element
    udElementProcessor *pProcessor = GetElementProcessor(state->GetClassInfo()->GetClassName());
    if(pProcessor)
    {
        pProcessor->ProcessElement(state);
    }
    else
    {
        pLang->SingleLineCommentCmd(wxString::Format(wxT( "!!! WARNING: UNSUPPORTED ELEMENT ('%s') !!!"), ((udProjectItem*)state->GetUserData())->GetName().c_str()));
        IPluginManager::Get()->Log(wxString::Format(wxT("WARNING: '%s' element is not supported by this algorithm."), ((udProjectItem*)state->GetUserData())->GetName().c_str()));
    }

    // set the state as processes
    m_lstProcessedElements.Append(state);
	m_pPrevElement = state;

    // process connected states
    ShapeList::compatibility_iterator node = lstNeighbours.GetFirst();
    while(node)
    {
		wxSFShapeBase *pNext = node->GetData();

		ProcessState( pNext );
			
        node = node->GetNext();
    }
}
Ejemplo n.º 16
0
wxRealPoint wxSFLayoutAlgorithm::GetShapesCenter(const ShapeList& shapes)
{
	wxRealPoint nCenter;
	
	for( ShapeList::const_iterator it = shapes.begin(); it != shapes.end(); ++ it )
	{
		nCenter = nCenter + (*it)->GetAbsolutePosition();
	}
	
	nCenter.x /= shapes.GetCount();
	nCenter.y /= shapes.GetCount();
	
	return nCenter;
}
Ejemplo n.º 17
0
wxSize wxSFLayoutAlgorithm::GetShapesExtent(const ShapeList& shapes)
{
	int nTotalWidth = 0, nTotalHeight = 0;
	
	for( ShapeList::const_iterator it = shapes.begin(); it != shapes.end(); ++ it )
	{
		wxRect rctBB = (*it)->GetBoundingBox();
		
		nTotalWidth += rctBB.GetWidth();
		nTotalHeight += rctBB.GetHeight();
	}
	
	return wxSize( nTotalWidth, nTotalHeight );
}
Ejemplo n.º 18
0
wxRealPoint wxSFLayoutAlgorithm::GetTopLeft(const ShapeList& shapes)
{
	double startx = INT_MAX, starty = INT_MAX;
	
	for( ShapeList::const_iterator it = shapes.begin(); it != shapes.end(); ++ it )
	{
		wxSFShapeBase *pShape = *it;
		
		wxRealPoint nPos = pShape->GetAbsolutePosition();
		if( nPos.x < startx ) startx = nPos.x;
		if( nPos.y < starty ) starty = nPos.y;
	}
	
	return wxRealPoint( startx, starty );
}
Ejemplo n.º 19
0
wxRect wxSFLayoutAlgorithm::GetBoundingBox(const ShapeList& shapes)
{
	wxRect rctBB;
	
	for( ShapeList::const_iterator it = shapes.begin(); it != shapes.end(); ++ it )
	{
		wxSFShapeBase *pShape = *it;
		
		if( it == shapes.begin() ) rctBB = pShape->GetBoundingBox();
		else
			rctBB.Union( pShape->GetBoundingBox() );
	}
	
	return rctBB;
}
Ejemplo n.º 20
0
	void Entity::init(const ShapeList & list, const MassProperties mass, const Transform t){
		std::vector< ::std::pair<size_t, Transform> > shapes;
		size_t compound;
		//Create the shapes
		for_each(list.begin(), list.end(), [&](const ShapeList::value_type & shape){
			switch(shape.first.type){
				case E_CAPSULE:
				case E_SPHERE:
				case E_BOX:
				case E_PLANE:
				{
					size_t s = createShape(
						shape.first.type,
						Math::Vec4ToVec3(shape.first.data),
						Math::VecLast(shape.first.data)
					);
					Transform t = shape.second;
					::std::pair<size_t, Transform> p(s,t);
					shapes.push_back(p);
				}
				break;
				case E_MESH:
				{
					size_t s = createShape(
						shape.first.type,
						shape.first.rawMesh
					);
					Transform t = shape.second;
					::std::pair<size_t, Transform> p(s,t);
					shapes.push_back(p);
				}
				break;
				default:
				{
					throw "Not valid shape type!";
				}
			}
		});
		//Got a list of shapes, make the compound shape
		compound = _world->compoundShapes(shapes);
		//Put it back on with the compound object first
		_shape_index.push_back(compound);
		for_each(shapes.begin(),shapes.end(),[&](decltype(shapes)::value_type s){
			_shape_index.push_back(s.first);
		});
		//create body
		makeBody(t, mass);
	}
Ejemplo n.º 21
0
void wxSFShapeBase::_OnDragging(const wxPoint& pos)
{
    //wxASSERT(m_pParentManager);
    if( !m_pParentManager )return;

	if(m_fVisible && m_fActive && (m_nStyle & sfsPOSITION_CHANGE))
	{
		if(m_fFirstMove)
		{
			m_nMouseOffset = wxRealPoint(pos.x, pos.y) - this->GetAbsolutePosition();
		}

        // get shape BB BEFORE movement and combine it with BB of assigned lines
		wxRect prevBB;
		GetCompleteBoundingBox(prevBB, bbSELF | bbCONNECTIONS | bbCHILDREN | bbSHADOW);

		this->MoveTo(pos.x - m_nMouseOffset.x, pos.y - m_nMouseOffset.y);
        this->OnDragging(pos);
		
		// GUI controls in child control shapes must be updated explicitely
		wxSFControlShape *pCtrl;
		ShapeList lstChildCtrls;
		
		GetChildShapes( CLASSINFO(wxSFControlShape), lstChildCtrls, sfRECURSIVE );
		ShapeList::compatibility_iterator node = lstChildCtrls.GetFirst();
		while( node )
		{
			pCtrl = (wxSFControlShape*) node->GetData();
			pCtrl->UpdateControl();
			
			node = node->GetNext();
		}

        // get shape BB AFTER movement and combine it with BB of assigned lines
		wxRect currBB;
		GetCompleteBoundingBox(currBB, bbSELF | bbCONNECTIONS | bbCHILDREN | bbSHADOW);

		// update canvas
		Refresh( prevBB.Union(currBB), sfDELAYED );

		m_fFirstMove = false;
	}
	
	if( GetParentShape() && (m_nStyle & sfsPROPAGATE_DRAGGING) )
	{
		GetParentShape()->_OnDragging( pos );
	}
}
Ejemplo n.º 22
0
void wxSFDiagramManager::GetShapesAtPosition(const wxPoint& pos, ShapeList& shapes)
{
	shapes.Clear();
	wxSFShapeBase *pShape;

    ShapeList lstShapes;
    GetShapes(CLASSINFO(wxSFShapeBase), lstShapes);

	ShapeList::compatibility_iterator node = lstShapes.GetFirst();
	while(node)
	{
		pShape = node->GetData();
		if(pShape->IsVisible() && pShape->IsActive() && pShape->Contains(pos))shapes.Append(pShape);
		node = node->GetNext();
	}
}
Ejemplo n.º 23
0
void wxSFDiagramManager::GetShapesInside(const wxRect& rct, ShapeList& shapes)
{
	shapes.Clear();
	wxSFShapeBase* pShape;

    ShapeList lstShapes;
    GetShapes(CLASSINFO(wxSFShapeBase), lstShapes);

	ShapeList::compatibility_iterator node = lstShapes.GetFirst();
	while(node)
	{
		pShape = node->GetData();
		if(pShape->IsVisible() && pShape->IsActive() && pShape->Intersects(rct))shapes.Append(pShape);
		node = node->GetNext();
	}
}
Ejemplo n.º 24
0
void wxSFMultiSelRect::OnEndHandle(wxSFShapeHandle& handle)
{
	// inform all selected shapes about end of the handle dragging

	if(GetParentCanvas())
	{
		ShapeList lstShapes;
		GetParentCanvas()->GetSelectedShapes(lstShapes);

		ShapeList::compatibility_iterator node = lstShapes.GetFirst();
		while(node)
		{
			node->GetData()->OnEndHandle(handle);
			node = node->GetNext();
		}
	}
}
Ejemplo n.º 25
0
void wxSFDiagramManager::UpdateAll()
{
	wxSFShapeBase *pShape;
	
	ShapeList lstShapes;
	GetShapes( CLASSINFO(wxSFShapeBase), lstShapes );
	
	ShapeList::compatibility_iterator node = lstShapes.GetFirst();
	while( node )
	{
		pShape = node->GetData();
		// update only shapes withour children because the Update() function is called recursively on all parents
		if( !HasChildren( pShape ) ) pShape->Update();
		
		node = node->GetNext();
	}
}
Ejemplo n.º 26
0
void wxSFDiagramManager::MoveShapesFromNegatives()
{
	wxSFShapeBase *pShape;
	wxRealPoint shapePos;
	double minx = 0, miny = 0;

	// find the maximal negative position value
    ShapeList shapes;
    GetShapes(CLASSINFO(wxSFShapeBase), shapes);

	ShapeList::compatibility_iterator node = shapes.GetFirst();
	while(node)
	{
		shapePos = node->GetData()->GetAbsolutePosition();

		if(node == shapes.GetFirst())
		{
			minx = shapePos.x;
			miny = shapePos.y;
		}
		else
		{
            if(shapePos.x < minx)minx = shapePos.x;
            if(shapePos.y < miny)miny = shapePos.y;
		}

		node = node->GetNext();
	}

	// move all parents shape so they (and their children) will be located in the positive values only
	if((minx < 0) || (miny < 0))
	{
		node = shapes.GetFirst();
		while(node)
		{
			pShape = node->GetData();

			if(pShape->GetParentShape() == NULL)
			{
				if(minx < 0)pShape->MoveBy(abs((int)minx), 0);
				if(miny < 0)pShape->MoveBy(0, abs((int)miny));
			}
			node = node->GetNext();
		}
	}
}
Ejemplo n.º 27
0
void wxSFShapePasteEvent::SetPastedShapes(const ShapeList &list)
{
	ShapeList::compatibility_iterator node = list.GetFirst();
	while(node)
	{
		m_lstPastedShapes.Append(node->GetData());
		node = node->GetNext();
	}
}
Ejemplo n.º 28
0
int
ShapeList::maxDepth() const
{
    int res = std::numeric_limits<int>::min();
    int d;
    ShapeList * sl;
    std::vector< Shape* >::const_iterator i = _shapes.begin();
    std::vector< Shape* >::const_iterator end = _shapes.end();
    while ( i != end ) {
        sl = dynamic_cast<ShapeList*>( *i );
        if ( sl ) {
            d = sl->maxDepth();
        } else {
            d = (*i)->depth();
        }
        if ( d > res ) res = d;
        ++i;
    }
    return res;
}
Ejemplo n.º 29
0
void Rectangle::loadRectangle(string fileName, ShapeList& s_list) // 파일 읽기용
{
	ifstream fin;
	fin.open(fileName, ios_base::in);

	int centerX;
	int centerY;
	int width;
	int height;

	while (!fin.eof()) // 파일의 끝에 도달하지 않았다면 계속 반복
	{
		fin >> centerX >> centerY >> width >> height; // 파일의 값을 읽음
		Rectangle* r = new Rectangle(centerX, centerY, width, height); // Student 임시 객체 생성
		s_list.insertShape(r);
		s_list.plusCount();
	}

	fin.close();
}
Ejemplo n.º 30
0
void DatabaseCanvas::AddQuickQueryFields(const wxString &tbl, std::vector<Field *> &quickSelectFields, bool quickSelect)
{
    ShapeList shapes;
    m_pManager.GetShapes( CLASSINFO( FieldShape ), shapes );
    for( ShapeList::iterator it = shapes.begin (); it != shapes.end (); ++it )
    {
        auto fld = wxDynamicCast( (*it), FieldShape );
        auto fieldName = wxDynamicCast( (*it), FieldShape )->GetField()->GetFieldName();
        auto found = false;
        for( std::vector<Field *>::iterator it2 = quickSelectFields.begin(); it2 < quickSelectFields.end() && !false; ++it2 )
        {
            if( (*it2)->GetFieldName() == fieldName )
            {
                found = true;
                (*it)->Select( true );
                dynamic_cast<DrawingView *>( m_view )->AddFieldToQuery( *fld, fld->IsSelected(), tbl.ToStdWstring(), quickSelect );
            }
        }
    }
    Refresh();
}