void rspfGeneralRasterElevFactory::setDirectory(const rspfFilename& directory) { rspfElevSourceFactory::setDirectory(directory); theGeneralRasterInfoList.clear(); rspfRefPtr<rspfGeneralRasterElevHandler> handler = new rspfGeneralRasterElevHandler; if(theDirectory.exists()) { if(theDirectory.isDir()) { rspfDirectory dir(theDirectory); rspfFilename file; rspf_uint32 maxCount = 10; // search at least the first 10 files to see if there are any here rspf_uint32 count = 0; bool foundOne = false; if(dir.getFirst(file)) { do { ++count; rspfString ext = file.ext(); ext = ext.downcase(); if(ext == "ras") { if(handler->open(file)) { foundOne = true; addInfo(handler->generalRasterInfo()); } } } while(dir.getNext(file) && (foundOne || (!foundOne && (count < maxCount)))); } } } }
void DebugInfo::visitFrameBufferObject(FrameBufferObject* fbo) { assert(fbo != nullptr); InfoUnit info; info.name = name("FrameBufferObject", fbo); for (FrameBufferAttachment* attachment: fbo->attachments()) { std::string objectName; if (attachment->isTextureAttachment()) { objectName = name("Texture", dynamic_cast<TextureAttachment*>(attachment)->texture()); } else { objectName = name("RenderBufferObject", dynamic_cast<RenderBufferAttachment*>(attachment)->renderBuffer()); } info.addProperty(attachment->attachmentString(), objectName); } addInfo("FrameBufferObjects", info); }
void PimSettingsBackupRestore::addDate() { const QDateTime now = QDateTime::currentDateTime(); Q_EMIT addInfo(QLatin1Char('[') + QLocale().toString((now), QLocale::ShortFormat) + QLatin1Char(']')); }
void ossimGeneralRasterElevHandler::initializeList(const ossimFilename& file) { close(); theFilename = file; theBoundingRectInfoList.clear(); if(theFilename.exists()) { if(theFilename.isDir()) { ossimDirectory dir(theFilename); ossimFilename file; ossim_uint32 maxCount = 10; ossim_uint32 count = 0; bool foundOne = false; if(dir.getFirst(file)) { do { ++count; ossimString ext = file.ext(); ext = ext.downcase(); if(ext == "ras") { ossimGeneralRasterElevHandler::BoundingRectInfo info; if(initializeInfo(info, file)) { foundOne = true; addInfo(info); } } } while(dir.getNext(file) && (!foundOne && (count < maxCount))); } #if 0 std::vector<ossimFilename> result; dir.findAllFilesThatMatch(result, ".*\\.ras"); if(result.size()) { ossimGeneralRasterElevHandler::BoundingRectInfo info; ossim_uint32 idx = 0; for(idx = 0; idx < result.size(); ++idx) { if(initializeInfo(info, ossimFilename(result[idx]))) { addInfo(info); } } } #endif if(theBoundingRectInfoList.size()>0) { theNullHeightValue = theBoundingRectInfoList[0].theNullHeightValue; } } else { ossimGeneralRasterElevHandler::BoundingRectInfo info; if(initializeInfo(info, theFilename)) { addInfo(info); } } } }
void ResourceSkin::deserialization(xml::ElementPtr _node, Version _version) { Base::deserialization(_node, _version); std::string stateCategory = SubWidgetManager::getInstance().getStateCategoryName(); // парсим атрибуты скина std::string name, texture, tmp; IntSize size; _node->findAttribute("name", name); _node->findAttribute("texture", texture); if (_node->findAttribute("size", tmp)) size = IntSize::parse(tmp); LanguageManager& localizator = LanguageManager::getInstance(); // вспомогательный класс для биндинга сабскинов SubWidgetBinding bind; // поддержка замены тегов в скинах if (_version >= Version(1, 1)) { texture = localizator.replaceTags(texture); } setInfo(size, texture); // проверяем маску if (_node->findAttribute("mask", tmp)) addProperty("MaskPick", tmp); // берем детей и крутимся, цикл с саб скинами xml::ElementEnumerator basis = _node->getElementEnumerator(); while (basis.next()) { if (basis->getName() == "Property") { // загружаем свойства std::string key, value; if (!basis->findAttribute("key", key)) continue; if (!basis->findAttribute("value", value)) continue; // поддержка замены тегов в скинах if (_version >= Version(1, 1)) { value = localizator.replaceTags(value); } // добавляем свойство addProperty(key, value); } else if (basis->getName() == "Child") { ChildSkinInfo child( basis->findAttribute("type"), WidgetStyle::parse(basis->findAttribute("style")), basis->findAttribute("skin"), IntCoord::parse(basis->findAttribute("offset")), Align::parse(basis->findAttribute("align")), basis->findAttribute("layer"), basis->findAttribute("name") ); xml::ElementEnumerator child_params = basis->getElementEnumerator(); while (child_params.next("Property")) child.addParam(child_params->findAttribute("key"), child_params->findAttribute("value")); addChild(child); //continue; } else if (basis->getName() == "BasisSkin") { // парсим атрибуты std::string basisSkinType, tmp_str; IntCoord offset; Align align = Align::Default; basis->findAttribute("type", basisSkinType); if (basis->findAttribute("offset", tmp_str)) offset = IntCoord::parse(tmp_str); if (basis->findAttribute("align", tmp_str)) align = Align::parse(tmp_str); bind.create(offset, align, basisSkinType); // берем детей и крутимся, цикл со стейтами xml::ElementEnumerator state = basis->getElementEnumerator(); // проверяем на новый формат стейтов bool new_format = false; // если версия меньше 1.0 то переименовываем стейты if (_version < Version(1, 0)) { while (state.next()) { if (state->getName() == "State") { const std::string& name_state = state->findAttribute("name"); if ((name_state == "normal_checked") || (state->findAttribute("name") == "normal_check")) { new_format = true; break; } } } // обновляем state = basis->getElementEnumerator(); } while (state.next()) { if (state->getName() == "State") { // парсим атрибуты стейта std::string basisStateName; state->findAttribute("name", basisStateName); // если версия меньше 1.0 то переименовываем стейты if (_version < Version(1, 0)) { // это обсолет новых типов if (basisStateName == "disable_check") basisStateName = "disabled_checked"; else if (basisStateName == "normal_check") basisStateName = "normal_checked"; else if (basisStateName == "active_check") basisStateName = "highlighted_checked"; else if (basisStateName == "pressed_check") basisStateName = "pushed_checked"; else if (basisStateName == "disable") basisStateName = "disabled"; else if (basisStateName == "active") basisStateName = "highlighted"; else if (basisStateName == "select") basisStateName = "pushed"; else if (basisStateName == "pressed") { if (new_format) basisStateName = "pushed"; else basisStateName = "normal_checked"; } } // конвертируем инфу о стейте IStateInfo* data = nullptr; IObject* object = FactoryManager::getInstance().createObject(stateCategory, basisSkinType); if (object != nullptr) { data = object->castType<IStateInfo>(); data->deserialization(state.current(), _version); } // добавляем инфо о стайте bind.add(basisStateName, data, name); } } // теперь всё вместе добавляем в скин addInfo(bind); } } }
const Status RelCatalog::createRel(const string & relation, const int attrCnt, const attrInfo attrList[]) { Status status; RelDesc rd; AttrDesc ad; if (relation.empty() || attrCnt < 1) return BADCATPARM; if (relation.length() >= sizeof rd.relName) return NAMETOOLONG; // make sure the relation doesn't already exist status = getInfo(relation, rd); if (status == OK) return RELEXISTS; if (status != RELNOTFOUND) return status; // make sure there are no duplicate attribute names unsigned int tupleWidth = attrList[0].attrLen; if (attrCnt > 1) { for(int i = 1; i < attrCnt; i++) { tupleWidth += attrList[i].attrLen; for(int j = 0; j < i; j++) if (strcmp(attrList[i].attrName, attrList[j].attrName) == 0) return DUPLATTR; } } if (tupleWidth > PAGESIZE) // should be more strict return ATTRTOOLONG; cout << "Creating relation " << relation << endl; // insert information about relation strcpy(rd.relName, relation.c_str()); rd.attrCnt = attrCnt; if ((status = addInfo(rd)) != OK) return status; // insert information about attributes strcpy(ad.relName, relation.c_str()); int offset = 0; for(int i = 0; i < attrCnt; i++) { if (strlen(attrList[i].attrName) >= sizeof ad.attrName) return NAMETOOLONG; strcpy(ad.attrName, attrList[i].attrName); ad.attrOffset = offset; ad.attrType = attrList[i].attrType; ad.attrLen = attrList[i].attrLen; if ((status = attrCat->addInfo(ad)) != OK) { cout << "got error return" << status << endl; return status; } offset += ad.attrLen; } // now create the actual heapfile to hold the relation status = createHeapFile (relation); if (status != OK) return status; return OK; }
void StagePreview::showPreview(sf::RenderWindow *window, const char *stageName, int x, int y) { if (stageName_ != 0) { delete stageName_; } stageName_ = new char[strlen(stageName) + 1]; strcpy(stageName_, stageName); SetPosition(wxPoint(x, y)); infoSizer_->Clear(true); descSizer_->Clear(true); BerryBotsEngine *engine = new BerryBotsEngine(0, fileManager_, 0); Stage *stage = engine->getStage(); try { engine->initStage(getStagesDir().c_str(), stageName, getCacheDir().c_str()); } catch (EngineException *e) { wxMessageDialog errorMessage(NULL, e->what(), "Preview failure", wxOK | wxICON_EXCLAMATION); errorMessage.ShowModal(); delete engine; delete e; return; } SetTitle(wxString::Format(wxT("%s"), stage->getName())); unsigned int targetWidth; unsigned int targetHeight; char *previewFilename = savePreviewImage(window, engine, targetWidth, targetHeight); wxImage previewImage(previewFilename); delete previewFilename; double backingScale = getBackingScaleFactor(); if (backingScale > 1) { targetWidth /= backingScale; targetHeight /= backingScale; } visualPreview_->SetMinSize(wxSize(targetWidth, targetHeight)); visualPreview_->SetMaxSize(wxSize(targetWidth, targetHeight)); #ifdef __WXOSX__ int padding = 4; #else int padding = 8; #endif wxSizer *infoGrid = new wxFlexGridSizer(2, 0, padding); addInfo(infoGrid, "Name:", stage->getName()); addInfo(infoGrid, "Size:", wxString::Format(wxT("%i x %i"), stage->getWidth(), stage->getHeight())); if (engine->getTeamSize() > 1) { addInfo(infoGrid, "Team size:", engine->getTeamSize()); } addInfo(infoGrid, "Walls:", (stage->getWallCount() - 4)); addInfo(infoGrid, "Zones:", stage->getZoneCount()); addInfo(infoGrid, "Starts:", stage->getStartCount()); int numStageShips = stage->getStageShipCount(); if (numStageShips > 0) { char **stageShips = stage->getStageShips(); for (int x = 0; x < numStageShips; x++) { const char *shipName = stageShips[x]; if (shipName != 0) { int count = 1; for (int y = x + 1; y < numStageShips; y++) { const char *shipName2 = stageShips[y]; if (shipName2 != 0 && strcmp(shipName, shipName2) == 0) { count++; stageShips[y] = 0; } } wxString wxShipName = (count == 1) ? wxString(stageShips[x]) : wxString::Format(wxT("%s x%i"), shipName, count); addInfo(infoGrid, (x == 0 ? "Ships:" : ""), wxShipName); } } } infoSizer_->Add(infoGrid); char *description = fileManager_->getStageDescription( getStagesDir().c_str(), stageName, getCacheDir().c_str()); if (description == 0) { std::string descstr("<No description>"); description = new char[descstr.length() + 1]; strcpy(description, descstr.c_str()); } wxStaticText *descCtrl = new wxStaticText(mainPanel_, wxID_ANY, description); descSizer_->Add(descCtrl); delete description; mainPanel_->GetSizer()->SetSizeHints(mainPanel_); mainPanel_->Layout(); Fit(); mainPanel_->SetFocus(); wxBitmap bitmap; #ifdef __WINDOWS__ bitmap = wxBitmap(previewImage); #else bitmap.CreateScaled(targetWidth, targetHeight, wxBITMAP_SCREEN_DEPTH, backingScale); wxMemoryDC dc(bitmap); double logicalScale = (backingScale > 1) ? (1.0 / backingScale) : 1; dc.SetLogicalScale(logicalScale, logicalScale); dc.DrawBitmap(wxBitmap(previewImage), 0, 0); #endif // On Windows, if we set the bitmap before the Layout/Fit stuff, we get visual // artifacts when paging through the stages with up/down keys. visualPreview_->SetBitmap(bitmap); delete engine; }
// Set the data object from the widgets. void ItemTransfer::widgetToData() { unsigned int i; _gltxFrame->getData(_curr); _link.setNumber(_toNumber->text()); _link.setShiftId(_toShift->getId()); _link.setStoreId(_toStore->getId()); _curr.setAccountId(_account->getId()); _quasar->db()->setActive(_curr, !_inactive->isChecked()); _quasar->db()->setActive(_link, !_inactive->isChecked()); vector<InfoPair> asset_info; vector<InfoPair> expense_info; fixed total_amt = 0.0; // Add the items vector<ItemLine>& items = _curr.items(); items.clear(); for (i = 0; i < _lines.size(); ++i) { const AdjItem& line = _lines[i]; if (line.item.id() == INVALID_ID) continue; ItemLine item; item.item_id = line.item.id(); item.number = line.number; item.size = line.size; item.size_qty = line.size_qty; item.quantity = -line.quantity; item.inv_cost = -line.inv_cost; item.ext_deposit = -line.ext_deposit; items.push_back(item); addInfo(asset_info, line.item.assetAccount(), -line.inv_cost); addInfo(expense_info, _company.depositAccount(), -line.ext_deposit); total_amt += line.inv_cost + line.ext_deposit; } // Post to the accounts vector<AccountLine>& accounts = _curr.accounts(); accounts.clear(); for (i = 0; i < asset_info.size(); ++i) { Id account_id = asset_info[i].first; fixed amount = asset_info[i].second; if (amount == 0.0) continue; accounts.push_back(AccountLine(account_id, amount)); } for (i = 0; i < expense_info.size(); ++i) { Id account_id = expense_info[i].first; fixed amount = expense_info[i].second; if (amount == 0.0) continue; accounts.push_back(AccountLine(account_id, amount)); } // Add the expense account Id expense_id = _account->getId(); if (expense_id != INVALID_ID) accounts.push_back(AccountLine(expense_id, total_amt)); }
void Point::putInfo() const { addInfo("coord_X = " + std::to_string(x) + "\n"); addInfo("coord_Y = " + std::to_string(y) + "\n"); }
void Rect::putInfo() const { addInfo("length = " + std::to_string(getMainSize()) + "\n"); addInfo("width = " + std::to_string(width) + "\n"); addInfo("area = " + std::to_string(getArea()) + "\n"); }
void Square::putInfo() const { addInfo("side = " + std::to_string(getMainSize()) + "\n"); addInfo("area = " + std::to_string(getArea()) + "\n"); }
void Circle::putInfo() const { addInfo("radius = " + std::to_string(getMainSize()) + "\n"); addInfo("area = " + std::to_string(getArea()) + "\n"); }
void Polyline::putInfo() const { addInfo("length = " + std::to_string(getLength()) + "\n"); }