vtkDataArray * avtRecenterExpression::DeriveVariable(vtkDataSet *in_ds) { if (activeVariable == NULL) { EXCEPTION2(ExpressionException, outputVariableName, "Asked to recenter, but did not " "specify which variable to recenter"); } debug5 << "avtRecenterExpression: recentering mode: "; if (recenterMode == Toggle) debug5 << "toggle" << endl; if (recenterMode == Nodal) debug5 << "nodal" << endl; if (recenterMode == Zonal) debug5 << "zonal" << endl; vtkDataArray *cell_data = in_ds->GetCellData()->GetArray(activeVariable); vtkDataArray *pt_data = in_ds->GetPointData()->GetArray(activeVariable); vtkDataArray *rv = NULL; avtCentering target; switch(recenterMode) { case Nodal: target = AVT_NODECENT; break; case Toggle: target = AVT_UNKNOWN_CENT; break; case Zonal: target = AVT_ZONECENT; break; } if (cell_data != NULL) rv = Recenter(in_ds, cell_data, AVT_ZONECENT, outputVariableName, target); else if (pt_data != NULL) rv = Recenter(in_ds, pt_data, AVT_NODECENT, outputVariableName, target); else { EXCEPTION2(ExpressionException, outputVariableName, "Was not able to locate variable to recenter."); } return rv; }
void QGLMap::UpdateView() { if (m_initialized) { Recenter(); if (m_tileView != NULL) { m_tileView->SetView(m_view_center.x(), m_view_center.y(), 1, m_scale); } glViewport(0, 0, width(), height()); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(m_view_top_left.x(), m_view_bottom_right.x(), m_view_bottom_right.y(), m_view_top_left.y(), -0.5f, 0.5f); update(); // Signal a view change as occured. The minimap listens for this // so that it can update its view box. emit SignalViewChange(m_view_top_left.x(), m_view_top_left.y(), m_view_bottom_right.x(), m_view_bottom_right.y()); } }
void CTravelTab::OnLButtonDown(UINT nFlags, CPoint point) { UNREFERENCED_PARAMETER(nFlags); ClientToScreen(&point); CRect rect; m_TravelMap.GetWindowRect(&rect); if ( rect.PtInRect(point) ) { short xc, yc, z; xc = (short) point.x - (short) rect.left; yc = (short) point.y - (short) rect.top; m_TravelMap.CtrlToMap(&xc, &yc); if(xc >= m_TravelMap.GetWidth()) xc = m_TravelMap.GetWidth()-1; if(yc >= m_TravelMap.GetHeight()) yc = m_TravelMap.GetHeight()-1; if(xc < 0) xc = 0; if(yc < 0) yc = 0; CString csCoords; z = m_TravelMap.GetMapHeight(xc, yc); csCoords.Format("%d,%d,%d", xc, yc, z); m_csCoords.SetWindowText(csCoords); Recenter(xc, yc); } }
void CTravelTab::OnChangeMapplane() { if ( this->IsWindowVisible() ) { Recenter(); if (Main->m_dlgWorldMap) { if (Main->m_dwShowMap) { short m = m_TravelMap.GetMapFile(); short w = m_TravelMap.GetWidth(); short h = m_TravelMap.GetHeight(); Main->m_dlgWorldMap->m_WorldMap.LoadMap(m, w, h); WORD wFlags = 0; if ( Main->m_dwDrawStatics ) wFlags |= 0x01; if ( Main->m_dwDrawDifs ) wFlags |= 0x02; Main->m_dlgWorldMap->m_WorldMap.SetDrawFlags(wFlags); short zoom; switch ( m ) { case 0: case 1: zoom = -3; break; case 2: case 3: case 4: case 5: zoom = -2; break; default: zoom = -3; break; } Main->m_dlgWorldMap->m_WorldMap.SetZoomLevel(zoom); Main->m_dlgWorldMap->m_WorldMap.SetMapFile(m); CString csMap; m_ceMapPlane.GetWindowText(csMap); if (Main->m_dwShowSpawnpoints) Main->m_dlgWorldMap->UpdateSpawnDisplay(atoi(csMap)); else Main->m_dlgWorldMap->m_WorldMap.RemoveDrawObjects(); CString csTitle; csTitle.Format("World Map #%s", csMap); Main->m_dlgWorldMap->SetWindowText(csTitle); Main->m_dlgWorldMap->UpdateSize(); Main->m_dlgWorldMap->m_WorldMap.UpdateMap(); } } } }
void CTravelTab::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { if (pScrollBar->m_hWnd == m_csbYScroll.m_hWnd) { int minpos; int maxpos; pScrollBar->GetScrollRange(&minpos, &maxpos); int curpos = pScrollBar->GetScrollPos(); switch (nSBCode) { case SB_TOP: // Scroll to far left. curpos = minpos; break; case SB_BOTTOM: // Scroll to far right. curpos = maxpos; break; case SB_ENDSCROLL: // End scroll. break; case SB_LINEUP: // Scroll left. if (curpos > minpos) curpos--; break; case SB_LINEDOWN: // Scroll right. if (curpos < maxpos) curpos++; break; case SB_PAGEUP: // Scroll one page left. { SCROLLINFO info; pScrollBar->GetScrollInfo(&info, SIF_ALL); if (curpos > minpos) curpos = max(minpos, curpos - (int) info.nPage); } break; case SB_PAGEDOWN: // Scroll one page right. { SCROLLINFO info; pScrollBar->GetScrollInfo(&info, SIF_ALL); if (curpos < maxpos) curpos = min(maxpos, curpos + (int) info.nPage); } break; case SB_THUMBPOSITION: // Scroll to absolute position. nPos is the position curpos = nPos; // of the scroll box at the end of the drag operation. break; case SB_THUMBTRACK: // Drag scroll box to specified position. nPos is the curpos = nPos; // position that the scroll box has been dragged to. break; } pScrollBar->SetScrollPos(curpos); m_TravelMap.SetYCenter((short)curpos); Recenter(m_TravelMap.GetXCenter(), (short)curpos); } CDockingPage::OnVScroll(nSBCode, nPos, pScrollBar); }
BOOL CTravelTab::OnInitDialog() { m_dcPropertyPage = Main->m_pcppTravelTab; if(m_bModifyDlgStylesAndPos == false) m_dcDialogPage = new CTravelTab; Main->m_pcppTravelTab->m_dcCurrentPage = this; CDockingPage::OnInitDialog(); // Set up the travel map window int X, Y, M, w, h, zoom; X = Main->GetRegistryDword("TravelTab Center X", 3077); Y = Main->GetRegistryDword("TravelTab Center Y", 2048); M = Main->GetRegistryDword("TravelTab MapPlane", 0); zoom = Main->GetRegistryDword("TravelTab Zoom", (DWORD)-2); CString csMap; csMap.Format("%d", M); m_TravelMap.SetZoomLevel((short) zoom); WORD wFlags = 0; if ( Main->m_dwDrawStatics ) wFlags |= 0x01; if ( Main->m_dwDrawDifs ) wFlags |= 0x02; m_TravelMap.SetDrawFlags(wFlags); m_ceMapPlane.SetWindowText(csMap); w = m_TravelMap.GetWidth(); h = m_TravelMap.GetHeight(); m_csbXScroll.SetScrollRange(0, w); m_csbXScroll.SetScrollPos(X); m_csbYScroll.SetScrollRange(0, h); m_csbYScroll.SetScrollPos(Y); xtempscroll = 0; ytempscroll = 0; Recenter((short) X, (short) Y); FillCategoryTree(); this->m_clcLocations.InsertColumn(0, "Description", LVCFMT_LEFT, 160, -1); this->m_clcLocations.InsertColumn(1, "Coordinates", LVCFMT_LEFT, 120, -1); m_iCurState = m_clcLocations.GetView(); cb_world.InitButton(IDI_WORLD,CMsg("IDS_WORLDMAP")); cb_world.SetBGColor(Main->crAxisBkg); cb_zoomin.InitButton(IDI_ZOOMIN,CMsg("IDS_ZOOMIN")); cb_zoomin.SetBGColor(Main->crAxisBkg); cb_zoomout.InitButton(IDI_ZOOMOUT,CMsg("IDS_ZOOMOUT")); cb_zoomout.SetBGColor(Main->crAxisBkg); cb_findarea.InitButton(IDI_FIND,CMsg("IDS_FINDAREA")); cb_findarea.SetBGColor(Main->crAxisBkg); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CTravelTab::OnItemchangedLocations(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; if (pNMListView->uNewState & LVNI_SELECTED) { int iSelIndex = this->m_clcLocations.GetNextItem(-1, LVNI_SELECTED); if (iSelIndex == -1) { this->m_csCoords.SetWindowText(""); Recenter(3077, 2048); return; } this->m_clcLocations.SetHotItem(iSelIndex); CSObject * pObject = (CSObject *) this->m_clcLocations.GetItemData(iSelIndex); if ( !pObject ) { this->m_cbRemoveLoc.EnableWindow(FALSE); this->m_cbEditLoc.EnableWindow(FALSE); return; } this->m_cbRemoveLoc.EnableWindow(pObject->m_bCustom ? TRUE : FALSE); this->m_cbEditLoc.EnableWindow(pObject->m_bCustom ? TRUE : FALSE); this->m_csCoords.SetWindowText(pObject->m_csID); this->m_ceMapPlane.SetWindowText(pObject->m_csDisplay); CString csX, csY, csZ; csX = pObject->m_csID.SpanExcluding(","); csY = pObject->m_csID.Mid(pObject->m_csID.Find(",") + 1); csZ = csY.Mid(csY.Find(",") + 1); csY = csY.SpanExcluding(","); Recenter((short)atoi(csX), (short)atoi(csY), (short)atoi(csZ), (short)atoi(pObject->m_csDisplay)); return; } this->m_cbRemoveLoc.EnableWindow(FALSE); this->m_cbEditLoc.EnableWindow(FALSE); *pResult = 0; }
void CTravelTab::OnLocate() { Main->bMemoryAccess = AdjustPrivileges(); DWORD dwProcessID; HANDLE m_hProcess; LPVOID lpAddress; CString csCoords; byte * pointer = new byte[Main->sizeX]; byte * pointer1 = new byte[Main->sizeY]; byte * pointer2 = new byte[Main->sizeZ]; byte * pointer3 = new byte[Main->sizeM]; if (!Main->calibrated) Calibrate(); if (Main->calibrated) { EnumWindows(EnumWindowsProc, 1); if ((Main->bMemoryAccess) && (hwndUOClient)) { GetWindowThreadProcessId(hwndUOClient, &dwProcessID); m_hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessID); lpAddress = (LPVOID)((DWORD_PTR)Main->LocX); ReadProcessMemory(m_hProcess, lpAddress, pointer, Main->sizeX, NULL); int x = (short)(pointer[0] | (pointer[1] << 8)); lpAddress = (LPVOID)((DWORD_PTR)Main->LocY); ReadProcessMemory(m_hProcess, lpAddress, pointer1, Main->sizeY, NULL); int y = (short)(pointer1[0] | (pointer1[1] << 8)); lpAddress = (LPVOID)((DWORD_PTR)Main->LocZ); ReadProcessMemory(m_hProcess, lpAddress, pointer2, Main->sizeZ, NULL); int z = (short)(pointer2[0] | (pointer2[1] << 8)); lpAddress = (LPVOID)((DWORD_PTR)Main->LocM); ReadProcessMemory(m_hProcess, lpAddress, pointer3, Main->sizeM, NULL); int m = (byte)pointer3[0]; csCoords.Format("%d",m); m_ceMapPlane.SetWindowText(csCoords); Recenter((short)x,(short)y,(short)z); CloseHandle( m_hProcess ); } else Main->calibrated = false; } }
BOOL CTravelTab::OnSetActive() { UpdateData(); if ( Main->m_pScripts->m_iACatSeq != m_iCatSeq ) this->FillCategoryTree(); WORD wFlags = 0; if ( Main->m_dwDrawStatics ) wFlags |= 0x01; if ( Main->m_dwDrawDifs ) wFlags |= 0x02; m_TravelMap.SetDrawFlags(wFlags); Recenter(); return CDockingPage::OnSetActive(); }
void CTravelTab::OnMouseMove(UINT nFlags, CPoint point) { ClientToScreen(&point); CRect rect; m_TravelMap.GetWindowRect(&rect); if ( (rect.PtInRect(point)) && (nFlags & MK_RBUTTON) ) { short xs, ys, xc, yc, zc, zoom; xs = (short) point.x - (short) rect.left - (short) xscroll; ys = (short) point.y - (short) rect.top - (short) yscroll; xscroll = point.x-rect.left; yscroll = point.y-rect.top; zoom = m_TravelMap.GetZoomLevel(); switch( zoom ) { case -4: xs *= 16; ys *= 16; xtempscroll = 0; ytempscroll = 0; break; case -3: xs *= 8; ys *= 8; xtempscroll = 0; ytempscroll = 0; break; case -2: xs *= 4; ys *= 4; xtempscroll = 0; ytempscroll = 0; break; case -1: xs *= 2; ys *= 2; xtempscroll = 0; ytempscroll = 0; break; case 0: break; xtempscroll = 0; ytempscroll = 0; case 1: xtempscroll += xs*8; ytempscroll += ys*8; break; case 2: xtempscroll += xs*4; ytempscroll += ys*4; break; case 3: xtempscroll += xs*2; ytempscroll += ys*2; break; case 4: xtempscroll += xs; ytempscroll += ys; break; } if (xtempscroll) { if(xtempscroll >= 16) { m_TravelMap.Scroll(6, 1); xtempscroll -= 16; } else if(xtempscroll <= -16) { m_TravelMap.Scroll(6, -1); xtempscroll += 16; } } else m_TravelMap.Scroll(6, xs); if (ytempscroll) { if(ytempscroll >= 16) { m_TravelMap.Scroll(0, 1); ytempscroll -= 16; } else if(ytempscroll <= -16) { m_TravelMap.Scroll(0, -1); ytempscroll += 16; } } else m_TravelMap.Scroll(0, ys); xc = m_TravelMap.GetXCenter(); yc = m_TravelMap.GetYCenter(); zc = m_TravelMap.GetMapHeight(xc, yc); CString csMessage; csMessage.Format("%d,%d,%d", xc, yc, zc); m_csCoords.SetWindowText(csMessage); Recenter(xc, yc); } }
void CTravelTab::RemoteRecenter(short x, short y, short z, short m) { Recenter(x, y, z, m); }
void CTravelTab::Recenter() { short x, y; m_TravelMap.GetCenter(&x, &y); Recenter(x, y); }
void CTravelTab::OnZoomin() { m_TravelMap.ZoomIn(); Recenter(); }
void CTravelTab::OnZoomout() { m_TravelMap.ZoomOut(); Recenter(); }
void avtTimeIteratorDataTreeIteratorExpression::PrepareAndExecuteDataset( vtkDataSet *ds, int ts) { std::vector<vtkDataArray *> ds_vars; std::vector<vtkDataArray *> delete_vars; bool haveZonal = false; size_t nvars = varnames.size(); if (cmfeType == POS_CMFE) nvars--; for (size_t i = 0 ; i < nvars ; i++) { std::string vname = GetInternalVarname(i); vtkDataArray *cell_data1 = ds->GetCellData()->GetArray(vname.c_str()); vtkDataArray *point_data1 = ds->GetPointData()->GetArray(vname.c_str()); if (cell_data1 == NULL && point_data1 == NULL) { EXCEPTION2(ExpressionException, outputVariableName, "An internal error occurred when calculating an expression." " Please contact a VisIt developer."); } haveZonal = (cell_data1 != NULL); } bool doZonal = false; if (haveZonal) doZonal = true; // mixed centering -> zonal for (size_t i = 0 ; i < nvars ; i++) { std::string vname = GetInternalVarname(i); vtkDataArray *cell_data1 = ds->GetCellData()->GetArray(vname.c_str()); vtkDataArray *point_data1 = ds->GetPointData()->GetArray(vname.c_str()); if (doZonal) { if (cell_data1 != NULL) ds_vars.push_back(cell_data1); else { vtkDataArray *tmp = Recenter(ds, point_data1, AVT_NODECENT, varnames[i], AVT_ZONECENT); ds_vars.push_back(tmp); delete_vars.push_back(tmp); } } else { if (point_data1 != NULL) ds_vars.push_back(point_data1); else { vtkDataArray *tmp = Recenter(ds, cell_data1, AVT_ZONECENT, varnames[i], AVT_NODECENT); ds_vars.push_back(tmp); delete_vars.push_back(tmp); } } } vtkDataArray *out_arr = vars[arrayIndex++]; ExecuteDataset(ds_vars, out_arr, ts); for (size_t i = 0 ; i < delete_vars.size() ; i++) delete_vars[i]->Delete(); }