void InternalResampleAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("InternalResampleAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("useTargetVal")) != 0) SetUseTargetVal(node->AsBool()); if((node = searchNode->GetNode("targetVal")) != 0) SetTargetVal(node->AsInt()); if((node = searchNode->GetNode("width")) != 0) SetWidth(node->AsInt()); if((node = searchNode->GetNode("height")) != 0) SetHeight(node->AsInt()); if((node = searchNode->GetNode("depth")) != 0) SetDepth(node->AsInt()); if((node = searchNode->GetNode("prefersPowersOfTwo")) != 0) SetPrefersPowersOfTwo(node->AsBool()); if((node = searchNode->GetNode("defaultVal")) != 0) SetDefaultVal(node->AsFloat()); if((node = searchNode->GetNode("useBounds")) != 0) SetUseBounds(node->AsBool()); if((node = searchNode->GetNode("minX")) != 0) SetMinX(node->AsDouble()); if((node = searchNode->GetNode("minY")) != 0) SetMinY(node->AsDouble()); if((node = searchNode->GetNode("minZ")) != 0) SetMinZ(node->AsDouble()); if((node = searchNode->GetNode("maxX")) != 0) SetMaxX(node->AsDouble()); if((node = searchNode->GetNode("maxY")) != 0) SetMaxY(node->AsDouble()); if((node = searchNode->GetNode("maxZ")) != 0) SetMaxZ(node->AsDouble()); if((node = searchNode->GetNode("useArbitrator")) != 0) SetUseArbitrator(node->AsBool()); if((node = searchNode->GetNode("arbitratorLessThan")) != 0) SetArbitratorLessThan(node->AsBool()); if((node = searchNode->GetNode("arbitratorVarName")) != 0) SetArbitratorVarName(node->AsString()); if((node = searchNode->GetNode("distributedResample")) != 0) SetDistributedResample(node->AsBool()); }
void CGraphPanel::AddPoint(SGraphChange* sgc) { //get main view pointer if (sgc->main_wnd_ptr == NULL) return; SSinglePoint ssp; CGraphProps* sgp = sgc->main_wnd_ptr->GetGraph(sgc->graphnum); if (!sgp->IsVisible()) { //if graph is not visible - do not do anything here return; }; sgp->GetPoint(sgc->index, &ssp); BOOL bNeedRedraw = FALSE; if ((unsigned long)(m_grflags & GRAPH_AUTOSCALE)) { //if grafix is autoscaled - just recalc coordinates and redraw the window if (ssp.x<__min(GetX1(), GetX2())) { SetMinX(ssp.x, FALSE); bNeedRedraw = TRUE; }; if (ssp.x>__max(GetX1(), GetX2())) { SetMaxX(ssp.x, FALSE); bNeedRedraw = TRUE; }; if (ssp.y<__min(GetY1(), GetY2())) { SetMinY(ssp.y, FALSE); bNeedRedraw = TRUE; }; if (ssp.y>__max(GetY1(), GetY2())) { SetMaxY(ssp.y, FALSE); bNeedRedraw = TRUE; }; }; //draw new point if (bNeedRedraw) { if (sgc->bRedraw) { UpdateGraphWindow(NULL); }; return; }; if (!sgc->bRedraw || offscreen == NULL) return; //if point is inside the graph - we need invalidate the whole picture if (sgc->index!=0 && sgc->index!=sgp->GetSize()-1) { if (sgc->bRedraw) { UpdateGraphWindow(NULL); }; return; }; int x, y, x1, y1; x = (int)CurrentCoordsX->WtoX(ssp.x); y = (int)CurrentCoordsY->WtoX(ssp.y); CDC* dc = offscreen->GetDibCDC(); if (dc != NULL) { CDC* cdc = GetDC(); CPen* pen = sgp->GetPen(); CBrush* brush = sgp->GetBrush(); CPen* oldpen = (CPen*)dc->SelectObject(pen); CBrush* oldbrush = (CBrush*)dc->SelectObject(brush); if (sgp->GetSize()>1) { if (sgc->index == 0) sgp->GetPoint(1, &ssp); if (sgc->index == sgp->GetSize()-1) sgp->GetPoint(sgc->index-1, &ssp); x1 = (int)CurrentCoordsX->WtoX(ssp.x); y1 = (int)CurrentCoordsY->WtoX(ssp.y); if (x != x1 || y != y1) { if ((m_grflags & GRAPH_GRAPH_SCATTER) == 0) { dc->MoveTo(x, y); dc->LineTo(x1, y1); }; if ((m_grflags & GRAPH_SQUAREPOINTS) != 0) { DrawSquarePoint(dc, x, y); }; CRect update_rect(x, y, x1, y1); update_rect.NormalizeRect(); update_rect.InflateRect(GetSquareSide(dc) + 2, GetSquareSide(dc) + 2); DoRedraw(cdc, update_rect); }; } else { if ((m_grflags & GRAPH_SQUAREPOINTS) != 0) { DrawSquarePoint(dc, x, y); CRect update_rect(x, y, x, y); update_rect.NormalizeRect(); update_rect.InflateRect(GetSquareSide(dc) + 2, GetSquareSide(dc) + 2); DoRedraw(cdc, update_rect); }; }; dc->SelectObject(oldpen); dc->SelectObject(oldbrush); sgp->ReleasePen(pen); sgp->ReleaseBrush(brush); ReleaseDC(cdc); }; }