void CDiagramEntity::Copy( CDiagramEntity* obj ) /* ============================================================ Function : CDiagramEntity::Copy Description : Copy the information in obj to this object. Return : void Parameters : CDiagramEntity* obj - The object to copy from. Usage : Copies basic information. from obj to this. GetType can be used to check for the correct object type in overridden versions. ============================================================*/ { Clear(); SetMarkerSize( obj->GetMarkerSize() ); SetConstraints( obj->GetMinimumSize(), obj->GetMaximumSize() ); Select( obj->IsSelected() ); SetParent( obj->GetParent() ); SetType( obj->GetType() ); SetTitle( obj->GetTitle() ); SetName( obj->GetName() ); Freeze( obj->IsFreezed()); SetVisible(obj->IsVisible()); SetRect( obj->GetLeft(), obj->GetTop(), obj->GetRight(), obj->GetBottom() ); }
void ApplyConstraints(Eigen::SparseMatrix<float>& K, const std::vector<Constraint>& constraints) { std::vector<int> indicesToConstraint; for (std::vector<Constraint>::const_iterator it = constraints.begin(); it != constraints.end(); ++it) { if (it->type & Constraint::UX) { indicesToConstraint.push_back(2 * it->node + 0); } if (it->type & Constraint::UY) { indicesToConstraint.push_back(2 * it->node + 1); } } for (int k = 0; k < K.outerSize(); ++k) { for (Eigen::SparseMatrix<float>::InnerIterator it(K, k); it; ++it) { for (std::vector<int>::iterator idit = indicesToConstraint.begin(); idit != indicesToConstraint.end(); ++idit) { SetConstraints(it, *idit); } } } }
void ConicSolver::SetConstraints(const LinearConstraint& constraint) { const MatrixXd& A = constraint.GetLhs(); const VectorXd& lb = constraint.GetLowerBounds(); const VectorXi& blb = constraint.GetIsLowerBounded(); const VectorXd& ub = constraint.GetUpperBounds(); const VectorXi& bub = constraint.GetIsUpperBounded(); SetConstraints(A, lb, blb, ub, bub); }
void CGumpButton::SetGump(STATE state, CGumpPtr pGump) { //ASSERT(pGump); m_pGump[state] = pGump; if (NORMAL==state && pGump) { CRect rect = GetRect(); CSize size = pGump->GetDimensions(); SetConstraints(size,size); SetRect(rect.left,rect.top,rect.left+size.cx,rect.top+size.cy); } }
void CDiagramEntity::Clear() /* ============================================================ Function : CDiagramEntity::Clear Description : Zero all properties of this object. Return : void Parameters : none Usage : Call to initialize the object. ============================================================*/ { SetParent( NULL ); SetRect( 0.0, 0.0, 0.0, 0.0 ); SetMarkerSize( CSize( 4, 4 ) ); SetConstraints( CSize( 1, 1 ), CSize( -1, -1 ) ); Select( FALSE ); SetName( _T( "" ) ); Freeze( FALSE ); SetVisible( TRUE ); }
CDiagramCombobox::CDiagramCombobox() /* ============================================================ Function : CDiagramCombobox::CDiagramCombobox Description : constructor Return : void Parameters : none Usage : ============================================================*/ { // Note the constraints SetConstraints( CSize( 20, 20 ), CSize( -1, 20 ) ); SetTitle( "Combobox" ); SetType( "combobox" ); SetName( "combobox" ); // SetPropertyDialog( &m_dlg, CEditPropertyDlg::IDD ); }
BOOL CGumpButton::FromString( XML::Node* node ) { if (!CGumpEntity::FromString(node)) return FALSE; int normal, over, pressed;; XML::Node* gump_node = node->findNode("gump"); if (gump_node) { gump_node->lookupAttribute("normal", normal); gump_node->lookupAttribute("over", over); gump_node->lookupAttribute("pressed", pressed); } CSize size = GetRect().Size(); SetConstraints(size,size); CGumpEditorDoc* pDoc = GfxGetGumpDocument(); ASSERT(pDoc); m_pGump[NORMAL] = pDoc->LoadGump(normal); m_pGump[HOVER] = pDoc->LoadGump(over); m_pGump[PRESSED] = pDoc->LoadGump(pressed); return TRUE; }