STDMETHODIMP CValueAxis::put_TitleFont(IFontDisp* pFont) { if (pFont) { CComQIPtr<IFont, &IID_IFont> p(pFont); if (p) { // 如果想等即返回 CComQIPtr<IFont, &IID_IFont> pOld(m_spTitleFont); if (p->IsEqual(pOld) == S_OK) return S_OK; m_spTitleFont = 0; CComPtr<IFont> pFont; p->Clone(&pFont); if (pFont) pFont->QueryInterface(IID_IFontDisp, (void**) &m_spTitleFont); } } else { if (m_spTitleFont == NULL) return S_OK; m_spTitleFont = 0; } m_pChart->RecalcRects(); m_pChart->FireViewChange(); return S_OK; }
void PolygonLine :: computeIntersectionPoints(Element *element, std :: vector< FloatArray > &oIntersectionPoints) { printf("Warning: entering PolygonLine :: computeIntersectionPoints(Element *element, std::vector< FloatArray > &oIntersectionPoints).\n"); #ifdef __BOOST_MODULE if ( !boundingBoxIntersects(element) ) { return; } for ( int i = 1; i <= element->giveNumberOfBoundarySides(); i++ ) { std :: vector< FloatArray >oneLineIntersects; ///@todo Move semantics or something would be useful here to avoid multiple copies. FloatArray a = * element->giveDofManager ( i )->giveCoordinates(); FloatArray b; if ( i != element->giveNumberOfBoundarySides() ) { b = * element->giveDofManager ( i + 1 )->giveCoordinates(); } else { b = * element->giveDofManager ( 1 )->giveCoordinates(); } Line l(a, b); computeIntersectionPoints(& l, oneLineIntersects); for ( FloatArray &interSect: oneLineIntersects ) { // Check that the intersection point has not already been identified. // This may happen if the crack intersects the element exactly at a node, // so that intersection is detected for both element edges in that node. // TODO: Set tolerance in a more transparent way. double distTol = 1.0e-9; bool alreadyFound = false; bPoint2 pNew( interSect.at(1), interSect.at(2) ); for ( FloatArray &pInterSect: oIntersectionPoints ) { bPoint2 pOld( pInterSect.at(1), pInterSect.at(2) ); if ( bDist(pOld, pNew) < distTol ) { alreadyFound = true; break; } } if ( !alreadyFound ) { oIntersectionPoints.push_back(interSect); } } } #endif }
int ElTawil2D::displaySelf(Renderer &theViewer, int displayMode, float fact) { this->YieldSurface_BC2D::displaySelf(theViewer, displayMode, fact); Vector pOld(3), pCurr(3); Vector rgb(3); rgb(0) = 0.1; rgb(1) = 0.5; rgb(2) = 0.5; if(displayMode == this->SurfOnly) { rgb(0) = 0.7; rgb(1) = 0.7; rgb(2) = 1.0; } // double incr = ((yPosCap/capY) - (yNegCap/capY)) / 10; double incr = fabs(0.33333333*yNegCap/capY); if(fact < 1) incr = fact; double xOld = 0; double yOld = yNegCap/capY; // hModel->toDeformedCoord(xOld, yOld); double err = 1e-4; for(double yc = yNegCap/capY; yc <= yPosCap/capY + err; yc = yc+incr) { double y = yc; double yVal = y*capY; double xVal; if(y < 0) { xVal = xBal*(1 - pow( fabs(yVal/yNegCap) , ty)); } else { xVal = xBal*(1 - pow( (yVal/yPosCap) , cz)); } double x = xVal/capX; if(displayMode==100) opserr << "(undeformed) x = " << x << ", y = " << y; double x1 = x; double y1 = y; double x2 = -x; double y2 = y; double x1Old = xOld; double y1Old = yOld; double x2Old = -xOld; double y2Old = yOld; hModel->toDeformedCoord(x1, y1); hModel->toDeformedCoord(x1Old, y1Old); hModel->toDeformedCoord(x2, y2); hModel->toDeformedCoord(x2Old, y2Old); // if(displayMode==100) // opserr << " (deformed) x = " << x << ", y = " << y << endln; pCurr(0) = x1; pCurr(1) = y1; pOld(0) = x1Old; pOld(1) = y1Old; theViewer.drawLine(pOld, pCurr, rgb, rgb); pCurr(0) = x2; pCurr(1) = y2; pOld(0) = x2Old; pOld(1) = y2Old; theViewer.drawLine(pOld, pCurr, rgb, rgb); xOld = x; yOld = y; } // displayForcePoint(theViewer, displayMode, fact); return 0; }
int Hajjar2D::displaySelf(Renderer &theViewer, int displayMode, float fact) { this->YieldSurface_BC2D::displaySelf(theViewer, displayMode, fact); // return 0; Vector pOld(3), pCurr(3); Vector rgb(3); rgb(0) = 0; rgb(1) = 0; rgb(2) = 0; double incr = 0.1; double x1, y1, xOld, yOld, x2, y2; double phi = 1; xOld = 0; //y = 0 yOld = sqrt( (phi - c1*xOld*xOld)/(c2 + c3*xOld*xOld) ); //x = 1 /*yOld += centroidY;*/ double xmax = sqrt(1/c1); opserr << " xmax = " << xmax << ", ymax = " << yOld << "( " << sqrt(1/c2) << ")\n"; if(fact < 1) incr = fact; double err = 0.5*incr; //for(double y = 0; y <= 1+err; y = y+incr) for(double x = 0; x <= xmax+err; x = x+incr) { if(x > xmax) x = xmax; double y = (phi - c1*x*x)/(c2 + c3*x*x); if(y > 0) y = sqrt(y); /*y += centroidY;*/ //if( x < 0.2) incr = 0.02; //if(x < 0.2 || x > 0.85) { if(displayMode==100) opserr << " x = " << x << ", y = " << y << "\n"; //////////////////////// x>0, y>0 x1 = x; y1 = y; hModel->toDeformedCoord(x1, y1); pCurr(0) = x1; pCurr(1) = y1; x2 = xOld; y2 = yOld; hModel->toDeformedCoord(x2, y2); pOld(0) = x2; pOld(1) = y2; theViewer.drawLine(pOld, pCurr, rgb, rgb); ///////////////////////// x<0, y>0 x1 = -1*x; y1 = y; hModel->toDeformedCoord(x1, y1); pCurr(0) = x1; pCurr(1) = y1; x2 = -1*xOld; y2 = yOld; hModel->toDeformedCoord(x2, y2); pOld(0) = x2; pOld(1) = y2; theViewer.drawLine(pOld, pCurr, rgb, rgb); //////////////////////// x>0, y<0 x1 = x; y1 = -1*y /*+ 2*centroidY*/; hModel->toDeformedCoord(x1, y1); pCurr(0) = x1; pCurr(1) = y1; x2 = xOld; y2 = -1*yOld/* + 2*centroidY*/; hModel->toDeformedCoord(x2, y2); pOld(0) = x2; pOld(1) = y2; theViewer.drawLine(pOld, pCurr, rgb, rgb); //////////////////////// x<0, y<0 x1 = -1*x; y1 = -1*y/* + 2*centroidY*/; hModel->toDeformedCoord(x1, y1); pCurr(0) = x1; pCurr(1) = y1; x2 = -1*xOld; y2 = -1*yOld/* + 2*centroidY*/; hModel->toDeformedCoord(x2, y2); pOld(0) = x2; pOld(1) = y2; theViewer.drawLine(pOld, pCurr, rgb, rgb); xOld = x; yOld = y; }//x > 0 } // displayForcePoint(theViewer, displayMode, fact); return 0; }