Error GraphicsObject::ChangeOccurred( ISubject* pSubject, System::Changes::BitMask ChangeType ) { ASSERT( m_bInitialized ); #if 0 if ( !m_pNode ) { // StaticGeom and InstancedGeom objects are abstract groupings and // are not globally attached to any scene node return Errors::Success; } if ( ChangeType & (System::Changes::Geometry::Position | System::Changes::Geometry::Orientation | System::Changes::Geometry::Scale) ) { IGeometryObject* pGeometryObject = dynamic_cast<IGeometryObject*>(pSubject); if ( NeedsLocking(m_pNode) ) { SCOPED_SPIN_LOCK(OGREGraphicsScene::m_mutex); UpdateGeometry( m_pNode, ChangeType, pGeometryObject ); } else { UpdateGeometry( m_pNode, ChangeType, pGeometryObject ); } } #endif return Errors::Success; }
CMemoryCardView::CMemoryCardView(HWND hParent, const RECT& rect) : m_itemCount(0) , m_memoryCard(NULL) , m_render(NULL) { if(!DoesWindowClassExist(CLSNAME)) { WNDCLASSEX wc; memset(&wc, 0, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = NULL; wc.hInstance = GetModuleHandle(NULL); wc.lpszClassName = CLSNAME; wc.lpfnWndProc = CWindow::WndProc; wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; RegisterClassEx(&wc); } Create(WS_EX_CLIENTEDGE, CLSNAME, _T(""), WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, rect, hParent, NULL); SetClassPtr(); UpdateGeometry(); m_render = new CRender(m_hWnd, &m_viewState); }
void CCalloutTextElement::DrawNormal(Display::IDisplayPtr pDisplay) { UpdateGeometry(pDisplay); if(!m_pGeometry) return; //绘制背景 if(m_bDrawBg) { pDisplay->SetSymbol( m_pFillSymbol.get() ); pDisplay->Begin(); pDisplay->Draw( m_pGeometry ); pDisplay->End(); } //绘制文字 GEOMETRY::geom::Envelope env(m_coordOrg.x,m_coordOrg.x,m_coordOrg.y,m_coordOrg.y); pDisplay->SetSymbol( m_pSymbol.get() ); pDisplay->Begin(); pDisplay->Draw( &env, m_text , m_bScaleWithMap); pDisplay->End(); }
void OrderedTaskPoint::UpdateOZ(const TaskProjection &projection) { UpdateGeometry(); SampledTaskPoint::UpdateOZ(projection); }
bool OrderedTask::Insert(const OrderedTaskPoint &new_tp, const unsigned position) { if (position >= task_points.size()) return Append(new_tp); if (/* is the new_tp allowed in this context? */ (position > 0 && !new_tp.IsPredecessorAllowed()) || !new_tp.IsSuccessorAllowed() || /* can a tp be inserted at this position? */ (position > 0 && !task_points[position - 1]->IsSuccessorAllowed()) || !task_points[position]->IsPredecessorAllowed()) return false; if (active_task_point >= position) active_task_point++; task_points.insert(task_points.begin() + position, new_tp.Clone(task_behaviour, ordered_behaviour)); if (position) SetNeighbours(position - 1); SetNeighbours(position); SetNeighbours(position + 1); UpdateGeometry(); return true; }
bool OrderedTask::Replace(const OrderedTaskPoint &new_tp, const unsigned position) { if (position >= task_points.size()) return false; if (task_points[position]->Equals(new_tp)) // nothing to do return true; /* is the new_tp allowed in this context? */ if ((position > 0 && !new_tp.IsPredecessorAllowed()) || (position + 1 < task_points.size() && !new_tp.IsSuccessorAllowed())) return false; delete task_points[position]; task_points[position] = new_tp.Clone(task_behaviour, ordered_behaviour); if (position) SetNeighbours(position - 1); SetNeighbours(position); if (position + 1 < task_points.size()) SetNeighbours(position + 1); UpdateGeometry(); return true; }
void Text::SetCharacterSize(unsigned int size) { if (myCharacterSize != size) { myCharacterSize = size; UpdateGeometry(); } }
void Text::SetFont(const Font& font) { if (myFont != &font) { myFont = &font; UpdateGeometry(); } }
void NMEALogWindow::DestroyWindow() { if (window) { UpdateGeometry(); window->Destroy(); window = NULL; } }
void CMiniMap::SetGeometry(int px, int py, int sx, int sy) { xpos = px; ypos = py; width = sx; height = sy; UpdateGeometry(); }
void Text::SetStyle(Uint32 style) { if (myStyle != style) { myStyle = style; UpdateGeometry(); } }
bool OrderedTask::Commit(const OrderedTask& that) { bool modified = false; SetName(that.GetName()); // change mode to that one SetFactory(that.factory_mode); // copy across behaviour SetOrderedTaskSettings(that.ordered_settings); // remove if that task is smaller than this one while (TaskSize() > that.TaskSize()) { Remove(TaskSize() - 1); modified = true; } // ensure each task point made identical for (unsigned i = 0; i < that.TaskSize(); ++i) { if (i >= TaskSize()) { // that task is larger than this Append(*that.task_points[i]); modified = true; } else if (!task_points[i]->Equals(*that.task_points[i])) { // that task point is changed Replace(*that.task_points[i], i); modified = true; } } // remove if that optional start list is smaller than this one while (optional_start_points.size() > that.optional_start_points.size()) { RemoveOptionalStart(optional_start_points.size() - 1); modified = true; } // ensure each task point made identical for (unsigned i = 0; i < that.optional_start_points.size(); ++i) { if (i >= optional_start_points.size()) { // that task is larger than this AppendOptionalStart(*that.optional_start_points[i]); modified = true; } else if (!optional_start_points[i]->Equals(*that.optional_start_points[i])) { // that task point is changed ReplaceOptionalStart(*that.optional_start_points[i], i); modified = true; } } if (modified) UpdateGeometry(); // @todo also re-scan task sample state, // potentially resetting task return modified; }
void OrderedTaskPoint::SetNeighbours(OrderedTaskPoint *_previous, OrderedTaskPoint *_next) { tp_previous = _previous; tp_next = _next; UpdateGeometry(); }
bool OrderedTask::AppendOptionalStart(const OrderedTaskPoint &new_tp) { optional_start_points.push_back(new_tp.Clone(task_behaviour, ordered_behaviour)); if (task_points.size() > 1) SetNeighbours(0); UpdateGeometry(); return true; }
Text::Text(const String& string, const Font& font, unsigned int characterSize) : myString (string), myFont (&font), myCharacterSize(characterSize), myStyle (Regular), myVertices (Quads), myBounds () { UpdateGeometry(); }
ClwScene& SceneTracker::CompileScene(Scene const& scene) const { auto iter = m_scene_cache.find(&scene); if (iter == m_scene_cache.cend()) { auto res = m_scene_cache.emplace(std::make_pair(&scene, ClwScene())); RecompileFull(scene, res.first->second); ReloadIntersector(scene, res.first->second); m_current_scene = &scene; return res.first->second; } else { auto& out = iter->second; if (scene.dirty() & Scene::DirtyFlags::kCamera) { UpdateCamera(scene, out); } if (scene.dirty() & Scene::DirtyFlags::kGeometry) { UpdateGeometry(scene, out); } else if (scene.dirty() & Scene::DirtyFlags::kGeometryTransform) { // TODO: this is not yet supported in the renderer } if (scene.dirty() & Scene::DirtyFlags::kMaterials) { UpdateMaterials(scene, out); } else if (scene.dirty() & Scene::DirtyFlags::kMaterialInputs) { UpdateMaterialInputs(scene, out); } if (m_current_scene != &scene) { ReloadIntersector(scene, out); m_current_scene = &scene; } scene.clear_dirty(); return out; } }
void EBox::SetMargin(float left, float right, float up, float down) { _marginLeft = left; _marginRight = right; _marginUp = up; _marginDown = down; SetMinWidth(); SetMinHeight(); UpdateGeometry(); UpdateChild(); }
void CMiniMap::MouseMove(int x, int y, int dx, int dy, int button) { if (mouseMove) { xpos += dx; ypos -= dy; xpos = std::max(0, xpos); if (gu->dualScreenMode) { xpos = std::min((2 * gu->viewSizeX) - width, xpos); } else { xpos = std::min(gu->viewSizeX - width, xpos); } ypos = std::max(5, std::min(gu->viewSizeY - height, ypos)); UpdateGeometry(); return; } if (mouseResize) { ypos -= dy; width += dx; height += dy; height = std::min(gu->viewSizeY, height); if (gu->dualScreenMode) { width = std::min(2 * gu->viewSizeX, width); } else { width = std::min(gu->viewSizeX, width); } if (keys[SDLK_LSHIFT]) { width = (height * gs->mapx) / gs->mapy; } width = std::max(5, width); height = std::max(5, height); ypos = std::min(gu->viewSizeY - height, ypos); UpdateGeometry(); return; } if (mouseLook && mapBox.Inside(x, y)) { MoveView(x,y); return; } }
void EBox::AddChild(EBox *child) { if (IsChild(child) || child == NULL || child == this) return; _vChilds.push_back(child); child->SetParent(this); if (child->_sizePolicy == MAXIMIZE) _nNumMaximizeChild++; UpdateGeometry(); UpdateChild(); }
void PolylinesRenderer::InitializeGL() { StockResources stock(GetResources()); geom_ = GetResources()->MakeGeometry(); material_ = stock.NewMaterial(StockResources::kPerVertexColorNoLighting); // Draw fat thick lines. material_->SetLineWidth(10.0f); draw_node_ = GetScene()->MakeDrawNode(GetBaseNode(), geom_, material_); UpdateGeometry(); }
bool OrderedTask::RemoveOptionalStart(const unsigned position) { if (position >= optional_start_points.size()) return false; EraseOptionalStartPoint(position); if (task_points.size()>1) SetNeighbours(0); UpdateGeometry(); return true; }
void ETextBox::SetFont(EFont *font, int nFontHeight) { XDELETE(_lpFont); if (font != NULL) _lpFont = new EFont(*font); _fMinTextWidth = 0; _nFontSize = 0; if (_lpFont != NULL) { _nFontSize = _lpFont->getHeightPix(); } SetMinWidth(); UpdateGeometry(); }
void ETextBox::SetText(const char *text) { int l = strlen(text) +1; if (_cText != NULL) { free(_cText); _cText = NULL; } _cText = (char *) malloc(l*sizeof(char)); KAssert(_cText != NULL); memset(_cText,0,l*sizeof(char)); strcpy(_cText,text); _fMinTextWidth = 0; SetMinWidth(); UpdateGeometry(); }
bool OrderedTask::Remove(const unsigned position) { if (position >= task_points.size()) return false; if (active_task_point > position || (active_task_point > 0 && active_task_point == task_points.size() - 1)) active_task_point--; ErasePoint(position); SetNeighbours(position); if (position) SetNeighbours(position - 1); UpdateGeometry(); return true; }
void CMiniMap::ToggleMaximized(bool _maxspect) { if (maximized) { xpos = oldxpos; ypos = oldypos; width = oldwidth; height = oldheight; } else { oldxpos = xpos; oldypos = ypos; oldwidth = width; oldheight = height; maxspect = _maxspect; SetMaximizedGeometry(); } maximized = !maximized; UpdateGeometry(); }
bool OrderedTask::ReplaceOptionalStart(const OrderedTaskPoint &new_tp, const unsigned position) { if (position >= optional_start_points.size()) return false; if (optional_start_points[position]->Equals(new_tp)) // nothing to do return true; delete optional_start_points[position]; optional_start_points[position] = new_tp.Clone(task_behaviour, ordered_behaviour); SetNeighbours(0); UpdateGeometry(); return true; }
void OrderedTask::SelectOptionalStart(unsigned pos) { assert(pos< optional_start_points.size()); // put task start onto end optional_start_points.push_back(task_points[0]); // set task start from top optional item task_points[0] = optional_start_points[pos]; // remove top optional item from list optional_start_points.erase(optional_start_points.begin()+pos); // update neighbour links SetNeighbours(0); if (task_points.size()>1) SetNeighbours(1); // we've changed the task, so update geometry UpdateGeometry(); }
bool OrderedTask::Append(const OrderedTaskPoint &new_tp) { if (/* is the new_tp allowed in this context? */ (!task_points.empty() && !new_tp.IsPredecessorAllowed()) || /* can a tp be appended after the last one? */ (task_points.size() >= 1 && !task_points[task_points.size() - 1]->IsSuccessorAllowed())) return false; task_points.push_back(new_tp.Clone(task_behaviour, ordered_behaviour)); if (task_points.size() > 1) SetNeighbours(task_points.size() - 2); else { // give it a value when we have one tp so it is not uninitialised last_min_location = new_tp.GetLocation(); } SetNeighbours(task_points.size() - 1); UpdateGeometry(); return true; }
void EBox::RemoveChild(EBox *child) { if (!IsChild(child) || child == NULL || child == this) return; if (child->_sizePolicy == MAXIMIZE) _nNumMaximizeChild--; EBox *tmp; for (int i=0; i < _vChilds.size(); i++) { if (_vChilds[i] == child) { tmp = _vChilds[i]; for (int j=i+1; j < _vChilds.size(); j++) { _vChilds[j-1] = _vChilds[j]; } _vChilds.pop_back(); if (tmp->GetParent() == this) tmp->SetParent(NULL); break; } } UpdateGeometry(); UpdateChild(); };
void CMiniMap::SetSlaveMode(bool newMode) { if (newMode) { proxyMode = false; selecting = false; maxspect = false; maximized = false; minimized = false; mouseLook = false; mouseMove = false; mouseResize = false; } static int oldButtonSize = 16; if (newMode != slaveDrawMode) { if (newMode) { oldButtonSize = buttonSize; buttonSize = 0; } else { buttonSize = oldButtonSize; } } slaveDrawMode = newMode; UpdateGeometry(); }