const std::string GENDRILL_WRITER_BASE::layerPairName( DRILL_LAYER_PAIR aPair ) const { std::string ret = layerName( aPair.first ); ret += '-'; ret += layerName( aPair.second ); return ret; }
const std::string EXCELLON_WRITER::layerPairName( LAYER_PAIR aPair ) const { std::string ret = layerName( aPair.first ); ret += '-'; ret += layerName( aPair.second ); return ret; }
void defiNonDefault::print(FILE* f) const { int i; fprintf(f, "nondefaultrule %s\n", name()); fprintf(f, "%d layers %d vias %d viarules %d mincuts\n", numLayers(), numVias(), numViaRules(), numMinCuts()); for (i = 0; i < numLayers(); i++) { fprintf(f, " Layer %s\n", layerName(i)); fprintf(f, " WIDTH %g\n", layerWidth(i)); if (hasLayerDiagWidth(i)) fprintf(f, " DIAGWIDTH %g\n", layerDiagWidth(i)); if (hasLayerSpacing(i)) fprintf(f, " SPACING %g\n", layerSpacing(i)); if (hasLayerWireExt(i)) fprintf(f, " WIREEXT %g\n", layerWireExt(i)); } for (i = 0; i < numVias(); i++) { fprintf(f, " VIA %s\n", viaName(i)); } for (i = 0; i < numViaRules(); i++) { fprintf(f, " VIARULE %s\n", viaRuleName(i)); } for (i = 0; i < numMinCuts(); i++) { fprintf(f, " MINCUTS %s %d\n", cutLayerName(i), numCuts(i)); } }
void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec ) { wxASSERT( aRow >= 0 ); int col; int index = aRow * LYR_COLUMN_COUNT; const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT; auto& iconProvider = useAlternateBitmap(aRow) ? alternativeRowIcons : defaultRowIcons; // column 0 col = COLUMN_ICON_ACTIVE; auto sbm = new INDICATOR_ICON( m_LayerScrolledWindow, iconProvider, ROW_ICON_PROVIDER::STATE::OFF, encodeId( col, aSpec.id ) ); sbm->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this ); m_LayersFlexGridSizer->wxSizer::Insert( index+col, sbm, 0, flags ); // column 1 (COLUMN_COLORBM) col = COLUMN_COLORBM; auto bmb = new COLOR_SWATCH( m_LayerScrolledWindow, aSpec.color, encodeId( col, aSpec.id ), AreArbitraryColorsAllowed(), getBackgroundLayerColor() ); bmb->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this ); bmb->Bind( COLOR_SWATCH_CHANGED, &LAYER_WIDGET::OnLayerSwatchChanged, this ); bmb->SetToolTip( _("Left double click or middle click for color change, right click for menu" ) ); m_LayersFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags ); // column 2 (COLUMN_COLOR_LYR_CB) col = COLUMN_COLOR_LYR_CB; wxCheckBox* cb = new wxCheckBox( m_LayerScrolledWindow, encodeId( col, aSpec.id ), wxEmptyString ); cb->SetValue( aSpec.state ); cb->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &LAYER_WIDGET::OnLayerCheckBox, this ); cb->SetToolTip( _( "Enable this for visibility" ) ); m_LayersFlexGridSizer->wxSizer::Insert( index+col, cb, 0, flags ); // column 3 (COLUMN_COLOR_LYRNAME) col = COLUMN_COLOR_LYRNAME; wxStaticText* st = new wxStaticText( m_LayerScrolledWindow, encodeId( col, aSpec.id ), aSpec.rowName ); shrinkFont( st, m_PointSize ); st->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this ); st->SetToolTip( aSpec.tooltip ); m_LayersFlexGridSizer->wxSizer::Insert( index+col, st, 0, flags ); // Bind right click eventhandler to all columns wxString layerName( aSpec.rowName ); sbm->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) { OnRightDownLayer( aEvt, bmb, layerName ); } ); bmb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) { OnRightDownLayer( aEvt, bmb, layerName ); } ); cb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) { OnRightDownLayer( aEvt, bmb, layerName ); } ); st->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) { OnRightDownLayer( aEvt, bmb, layerName ); } ); }
QgsServerProjectParser::QgsServerProjectParser( QDomDocument* xmlDoc, const QString& filePath ): mXMLDoc( xmlDoc ), mProjectPath( filePath ) { //accelerate the search for layers, groups and the creation of annotation items if ( mXMLDoc ) { QDomNodeList layerNodeList = mXMLDoc->elementsByTagName( "maplayer" ); QDomElement currentElement; int nNodes = layerNodeList.size(); for ( int i = 0; i < nNodes; ++i ) { currentElement = layerNodeList.at( i ).toElement(); mProjectLayerElements.push_back( currentElement ); mProjectLayerElementsByName.insert( layerName( currentElement ), currentElement ); mProjectLayerElementsById.insert( layerId( currentElement ), currentElement ); } QDomElement legendElement = mXMLDoc->documentElement().firstChildElement( "legend" ); if ( !legendElement.isNull() ) { QDomNodeList groupNodeList = legendElement.elementsByTagName( "legendgroup" ); for ( int i = 0; i < groupNodeList.size(); ++i ) { mLegendGroupElements.push_back( groupNodeList.at( i ).toElement() ); } } mRestrictedLayers = findRestrictedLayers(); } }
QgsProjectParser::QgsProjectParser( QDomDocument* xmlDoc, const QString& filePath ): QgsConfigParser(), mXMLDoc( xmlDoc ), mProjectPath( filePath ) { mOutputUnits = QgsMapRenderer::Millimeters; setLegendParametersFromProject(); setSelectionColor(); setMaxWidthHeight(); //accelerate search for layers and groups if ( mXMLDoc ) { QDomNodeList layerNodeList = mXMLDoc->elementsByTagName( "maplayer" ); QDomElement currentElement; int nNodes = layerNodeList.size(); for ( int i = 0; i < nNodes; ++i ) { currentElement = layerNodeList.at( i ).toElement(); mProjectLayerElements.push_back( currentElement ); mProjectLayerElementsByName.insert( layerName( currentElement ), currentElement ); mProjectLayerElementsById.insert( layerId( currentElement ), currentElement ); } QDomElement legendElement = mXMLDoc->documentElement().firstChildElement( "legend" ); if ( !legendElement.isNull() ) { QDomNodeList groupNodeList = legendElement.elementsByTagName( "legendgroup" ); for ( int i = 0; i < groupNodeList.size(); ++i ) { mLegendGroupElements.push_back( groupNodeList.at( i ).toElement() ); } } } }
bool QgsServerProjectParser::checkLayerGroupAttribute( const QString& attributeName, const QString& layerId ) const { //search layer (if it is a layer), test if attribute is true. If not, return false. QString lName; QHash< QString, QDomElement >::const_iterator layerIt = mProjectLayerElementsById.find( layerId ); if ( layerIt != mProjectLayerElementsById.constEnd() ) { if ( !layerIt.value().attribute( attributeName, "1" ).toInt() ) { return false; } lName = layerName( layerIt.value() ); } QDomElement currentElement; if ( lName.isEmpty() ) { currentElement = legendGroupByName( layerId ); } else { //get <legendlayer> element from legend section QDomElement legendElement = legendElem(); QDomNodeList layerNodeList = legendElement.elementsByTagName( "legendlayer" ); for ( int i = 0; i < layerNodeList.size(); ++i ) { QDomElement currentLayerElement = layerNodeList.at( i ).toElement(); if ( currentLayerElement.attribute( "name" ) == lName ) { currentElement = currentLayerElement; if ( !currentElement.attribute( attributeName, "1" ).toInt() ) { return false; } break; } } } if ( currentElement.isNull() ) { return false; } while ( !currentElement.parentNode().isNull() ) { if ( currentElement.attribute( attributeName, "1" ).toInt() != 1 ) { return false; } if ( currentElement.parentNode().nodeName() != "legendgroup" ) { break; } currentElement = currentElement.parentNode().toElement(); } return true; }
QDomElement KTSoundLayer::toXml(QDomDocument &doc) const { QDomElement root = doc.createElement("soundlayer"); root.setAttribute("name", layerName()); root.setAttribute("symbol", k->symbolName); return root; }
void KTSoundLayer::fromXml(const QString &xml) { QDomDocument document; if (! document.setContent(xml)) return; QDomElement root = document.documentElement(); setLayerName(root.attribute("name", layerName())); fromSymbol(root.attribute("symbol")); }
void defiFill::print(FILE* f) const { int i, j; struct defiPoints points; if (hasLayer()) fprintf(f, "- LAYER %s", layerName()); if (layerMask()) fprintf(f, " + Mask %d", layerMask()); if (hasLayerOpc()) fprintf(f, " + OPC"); fprintf(f, "\n"); for (i = 0; i < numRectangles(); i++) { fprintf(f, " RECT %d %d %d %d\n", xl(i), yl(i), xh(i), yh(i)); } for (i = 0; i < numPolygons(); i++) { fprintf(f, " POLYGON "); points = getPolygon(i); for (j = 0; j < points.numPoints; j++) fprintf(f, "%d %d ", points.x[j], points.y[j]); fprintf(f, "\n"); } fprintf(f,"\n"); if (hasVia()) fprintf(f, "- VIA %s", viaName()); if (viaTopMask() || viaCutMask() || viaBottomMask()) { fprintf(f, " + MASK %d", viaTopMask(), viaCutMask(), viaBottomMask()); } if (hasViaOpc()) fprintf(f, " + OPC"); fprintf(f, "\n"); for (i = 0; i < numViaPts(); i++) { fprintf(f, " "); points = getViaPts(i); for (j = 0; j < points.numPoints; j++) fprintf(f, "%d %d ", points.x[j], points.y[j]); fprintf(f, "\n"); } fprintf(f,"\n"); }
void QgsLayerTreeLayer::writeXML( QDomElement& parentElement ) { QDomDocument doc = parentElement.ownerDocument(); QDomElement elem = doc.createElement( "layer-tree-layer" ); elem.setAttribute( "id", mLayerId ); elem.setAttribute( "name", layerName() ); elem.setAttribute( "checked", QgsLayerTreeUtils::checkStateToXml( mVisible ) ); elem.setAttribute( "expanded", mExpanded ? "1" : "0" ); writeCommonXML( elem ); parentElement.appendChild( elem ); }
QgsServerProjectParser::QgsServerProjectParser( QDomDocument* xmlDoc, const QString& filePath ) : mXMLDoc( xmlDoc ) , mProjectPath( filePath ) , mUseLayerIDs( false ) { //accelerate the search for layers, groups and the creation of annotation items if ( mXMLDoc ) { QDomNodeList layerNodeList = mXMLDoc->elementsByTagName( "maplayer" ); QDomElement currentElement; int nNodes = layerNodeList.size(); for ( int i = 0; i < nNodes; ++i ) { currentElement = layerNodeList.at( i ).toElement(); mProjectLayerElements.push_back( currentElement ); mProjectLayerElementsByName.insert( layerName( currentElement ), currentElement ); mProjectLayerElementsById.insert( layerId( currentElement ), currentElement ); } QDomElement legendElement = mXMLDoc->documentElement().firstChildElement( "legend" ); if ( !legendElement.isNull() ) { QDomNodeList groupNodeList = legendElement.elementsByTagName( "legendgroup" ); for ( int i = 0; i < groupNodeList.size(); ++i ) { mLegendGroupElements.push_back( groupNodeList.at( i ).toElement() ); } } mUseLayerIDs = findUseLayerIDs(); mRestrictedLayers = findRestrictedLayers(); mCustomLayerOrder.clear(); QDomElement customOrder = mXMLDoc->documentElement().firstChildElement( "layer-tree-canvas" ).firstChildElement( "custom-order" ); if ( customOrder.attribute( "enabled" ) == "1" ) { QDomNodeList items = customOrder.childNodes(); for ( int i = 0; i < items.size(); ++i ) { mCustomLayerOrder << items.item( i ).toElement().text(); } } } // Setting the QgsProject instance fileName // to help converting relative pathes to absolute if ( mProjectPath != "" ) { QgsProject::instance()->setFileName( mProjectPath ); } }
QString QgsMapLayer::capitaliseLayerName( const QString& name ) { // Capitalise the first letter of the layer name if requested QSettings settings; bool capitaliseLayerName = settings.value( "/qgis/capitaliseLayerName", QVariant( false ) ).toBool(); QString layerName( name ); if ( capitaliseLayerName ) layerName = layerName.left( 1 ).toUpper() + layerName.mid( 1 ); return layerName; }
void EditorMap::save() { QString filename = QDir(EditorResourceManager::mapsDir()).absoluteFilePath(m_name); QFile file(filename); file.open(QIODevice::WriteOnly | QIODevice::Text); if( ! file.isOpen() ){ qDebug() << "Unable to open " << filename << " for writing"; return; } QTextStream out(&file); out << "version=" << c_codeVersion << "\n"; out << "# size=sizeX,sizeY,layerCount\n"; out << "# sizes in number of tiles, not in actual coordinates.\n"; out << "size=" << tileCountX() << "," << tileCountY() << "," << layerCount() << "\n\n"; out << "# layer declarations. one declaration per layer\n"; out << "# layer=layerName\n"; for (int i=0; i<layerCount(); ++i) out << "layer=" << layerName(i) << "\n"; out << "\n"; out << "# object declarations. uses tile coordinates\n"; out << "# object=tileX,tileY,layerIndex,objectId\n"; for (int layerIndex=0; layerIndex<m_layers.size(); ++layerIndex) { QList<MapObject *> objects = m_layers.at(layerIndex)->objects; for (int i=0; i<objects.size(); ++i) { MapObject * object = objects.at(i); if (object->layer == layerIndex) out << "object=" << object->tileX << "," << object->tileY << "," << layerIndex << "," << object->object->resourceName() << "\n"; } } out << "\n"; out << "# entity declarations. use absolute coordinates\n"; out << "# entity=x,y,layerIndex,entityId\n"; for (int layerIndex=0; layerIndex<m_layers.size(); ++layerIndex) { QList<EditorEntity *> entities = m_layers.at(layerIndex)->entities; for (int i=0; i<entities.size(); ++i) { EditorEntity * entity = entities.at(i); out << "entity=" << entity->centerX() << "," << entity->centerY() << "," << entity->layer() << "," << entity->name() << "\n"; } } }
QMap< QString, QDomElement > QgsProjectParser::projectLayerElementsByName() const { QMap< QString, QDomElement > layerMap; if ( !mXMLDoc ) { return layerMap; } QDomNodeList layerNodeList = mXMLDoc->elementsByTagName( "maplayer" ); QDomElement currentElement; int nNodes = layerNodeList.size(); for ( int i = 0; i < nNodes; ++i ) { currentElement = layerNodeList.at( i ).toElement(); layerMap.insert( layerName( currentElement ), currentElement ); } return layerMap; }
void atomAnimLayers::deleteEmptyLayers(bool replaceLayers) { if(replaceLayers == true && mLayersWithRemovedAttrs.size() > 0) { for(std::set<std::string>::iterator iter = mLayersWithRemovedAttrs.begin(); iter != mLayersWithRemovedAttrs.end(); ++iter) { std::string str = *iter; MString layerName(str.c_str()); MStringArray resultArray; MString melCommand = MString("animLayer -query -attribute ") + MString("\"") + layerName + MString("\""); MGlobal::executeCommand(melCommand, resultArray, false, false ); if(resultArray.length() ==0) //it has no attributes so delete it.. { melCommand = MString("delete ") + MString("\"") + layerName + MString("\""); MGlobal::executeCommand(melCommand,false,false); } } } }
int QgsProjectParser::layersAndStyles( QStringList& layers, QStringList& styles ) const { layers.clear(); styles.clear(); QList<QDomElement> layerElemList = projectLayerElements(); QList<QDomElement>::const_iterator elemIt = layerElemList.constBegin(); QString currentLayerName; for ( ; elemIt != layerElemList.constEnd(); ++elemIt ) { currentLayerName = layerName( *elemIt ); if ( !currentLayerName.isNull() ) { layers << currentLayerName; styles << "default"; } } return 0; }
void KTLayer::fromXml(const QString &xml) { QDomDocument document; if (! document.setContent(xml)) return; QDomElement root = document.documentElement(); setLayerName(root.attribute("name", layerName())); QDomNode n = root.firstChild(); while (!n.isNull()) { QDomElement e = n.toElement(); if (!e.isNull()) { if (e.tagName() == "frame") { KTFrame *frame = createFrame( k->frames.count(), true ); if (frame) { QString newDoc; { QTextStream ts(&newDoc); ts << n; } frame->fromXml(newDoc); } } } n = n.nextSibling(); } }
QgsMapLayer* QgsServerProjectParser::createLayerFromElement( const QDomElement& elem, bool useCache ) const { if ( elem.isNull() || !mXMLDoc ) { return 0; } addJoinLayersForElement( elem, useCache ); addValueRelationLayersForElement( elem, useCache ); QDomElement dataSourceElem = elem.firstChildElement( "datasource" ); QString uri = dataSourceElem.text(); QString absoluteUri; if ( !dataSourceElem.isNull() ) { //convert relative pathes to absolute ones if necessary if ( uri.startsWith( "dbname" ) ) //database { QgsDataSourceURI dsUri( uri ); if ( dsUri.host().isEmpty() ) //only convert path for file based databases { QString dbnameUri = dsUri.database(); QString dbNameUriAbsolute = convertToAbsolutePath( dbnameUri ); if ( dbnameUri != dbNameUriAbsolute ) { dsUri.setDatabase( dbNameUriAbsolute ); absoluteUri = dsUri.uri(); QDomText absoluteTextNode = mXMLDoc->createTextNode( absoluteUri ); dataSourceElem.replaceChild( absoluteTextNode, dataSourceElem.firstChild() ); } } } else if ( uri.startsWith( "file:" ) ) //a file based datasource in url notation (e.g. delimited text layer) { QString filePath = uri.mid( 5, uri.indexOf( "?" ) - 5 ); QString absoluteFilePath = convertToAbsolutePath( filePath ); if ( filePath != absoluteFilePath ) { QUrl destUrl = QUrl::fromEncoded( uri.toAscii() ); destUrl.setScheme( "file" ); destUrl.setPath( absoluteFilePath ); absoluteUri = destUrl.toEncoded(); QDomText absoluteTextNode = mXMLDoc->createTextNode( absoluteUri ); dataSourceElem.replaceChild( absoluteTextNode, dataSourceElem.firstChild() ); } else { absoluteUri = uri; } } else //file based data source { absoluteUri = convertToAbsolutePath( uri ); if ( uri != absoluteUri ) { QDomText absoluteTextNode = mXMLDoc->createTextNode( absoluteUri ); dataSourceElem.replaceChild( absoluteTextNode, dataSourceElem.firstChild() ); } } } QString id = layerId( elem ); QgsMapLayer* layer = 0; if ( useCache ) { layer = QgsMSLayerCache::instance()->searchLayer( absoluteUri, id ); } if ( layer ) { return layer; } QString type = elem.attribute( "type" ); if ( type == "vector" ) { layer = new QgsVectorLayer(); } else if ( type == "raster" ) { layer = new QgsRasterLayer(); } else if ( elem.attribute( "embedded" ) == "1" ) //layer is embedded from another project file { //todo: fixme /* QString project = convertToAbsolutePath( elem.attribute( "project" ) ); QgsDebugMsg( QString( "Project path: %1" ).arg( project ) ); QgsProjectParser* otherConfig = dynamic_cast<QgsProjectParser*>( QgsConfigCache::instance()->searchConfiguration( project ) ); if ( !otherConfig ) { return 0; } QHash< QString, QDomElement >::const_iterator layerIt = otherConfig->mProjectLayerElementsById.find( elem.attribute( "id" ) ); if ( layerIt == otherConfig->mProjectLayerElementsById.constEnd() ) { return 0; } return otherConfig->createLayerFromElement( layerIt.value() ); */ } if ( layer ) { layer->readLayerXML( const_cast<QDomElement&>( elem ) ); //should be changed to const in QgsMapLayer layer->setLayerName( layerName( elem ) ); if ( useCache ) { QgsMSLayerCache::instance()->insertLayer( absoluteUri, id, layer, mProjectPath ); } else { //todo: fixme //mLayersToRemove.push_back( layer ); } } return layer; }
GpuDevice GraphicsInstance::CreateGpuDevice(int , bool, bool) { auto canPresent = [](vk::PhysicalDevice dev) { auto queueProperties = dev.getQueueFamilyProperties(); for (auto&& queueProp : queueProperties) { for (uint32_t i = 0; i < queueProp.queueCount(); ++i) { #if defined(PLATFORM_WINDOWS) if (dev.getWin32PresentationSupportKHR(i)) #endif { return true; } } } return false; }; int devId = 0; for (devId = 0; devId < m_devices.size(); ++devId) { if (canPresent(m_devices[devId])) break; } auto&& physDev = m_devices[devId]; // assuming first device is best // layers std::vector<vk::LayerProperties> devLayers; physDev.enumerateDeviceLayerProperties(devLayers); std::vector<const char*> layers; { // lunargvalidation list order F_LOG("Enabled Vulkan debug layers for device:\n"); for (auto&& it : layerOrder) { auto found = std::find_if(devLayers.begin(), devLayers.end(), [&](const vk::LayerProperties& layer) { return it == layer.layerName(); }); if (found != devLayers.end()) { layers.push_back(it.c_str()); m_layers.push_back(*found); F_LOG("%s\n", found->layerName()); } } } // extensions std::vector<vk::ExtensionProperties> devExts; auto res = physDev.enumerateDeviceExtensionProperties("", devExts); if (res != vk::Result::eSuccess) { auto error = vk::getString(res); F_LOG("Device creation error: %s\n", error.c_str()); } std::vector<const char*> extensions; { // lunargvalidation list order F_LOG("Enabled Vulkan extensions for device:\n"); for (auto&& it : devExtOrder) { auto found = std::find_if(devExts.begin(), devExts.end(), [&](const vk::ExtensionProperties& layer) { return it == layer.extensionName(); }); if (found != devExts.end()) { extensions.push_back(it.c_str()); m_extensions.push_back(*found); F_LOG("found %s\n", found->extensionName()); } } } // queue //auto queueProperties = vk::getPhysicalDeviceQueueFamilyProperties(physDev); auto queueProperties = physDev.getQueueFamilyProperties(); std::vector<vk::DeviceQueueCreateInfo> queueInfos; uint32_t i = 0; std::vector<std::vector<float>> priorities; for (auto&& queueProp : queueProperties) { priorities.push_back(std::vector<float>()); for (size_t k = 0; k < queueProp.queueCount(); ++k) { priorities[i].push_back(1.f); } vk::DeviceQueueCreateInfo queueInfo = vk::DeviceQueueCreateInfo() .sType(vk::StructureType::eDeviceQueueCreateInfo) .queueFamilyIndex(i) .queueCount(queueProp.queueCount()) .pQueuePriorities(priorities[i].data()); // queue priorities go here. queueInfos.push_back(queueInfo); ++i; } auto features = physDev.getFeatures(); auto device_info = vk::DeviceCreateInfo() .sType(vk::StructureType::eDeviceCreateInfo) .queueCreateInfoCount(static_cast<uint32_t>(queueInfos.size())) .pQueueCreateInfos(queueInfos.data()) .enabledLayerCount(static_cast<uint32_t>(layers.size())) .ppEnabledLayerNames(layers.data()) .enabledExtensionCount(static_cast<uint32_t>(extensions.size())) .ppEnabledExtensionNames(extensions.data()) .pEnabledFeatures(&features); auto dev = physDev.createDevice(device_info, m_alloc_info); FazPtrVk<vk::Device> device(dev, [=](vk::Device ist) { ist.destroy(&m_alloc_info); }); return GpuDevice(device, m_alloc_info, false); }
bool GENDRILL_WRITER_BASE::GenDrillReportFile( const wxString& aFullFileName ) { FILE_OUTPUTFORMATTER out( aFullFileName ); static const char separator[] = " =============================================================\n"; wxASSERT( m_pcb ); unsigned totalHoleCount; wxString brdFilename = m_pcb->GetFileName(); std::vector<DRILL_LAYER_PAIR> hole_sets = getUniqueLayerPairs(); out.Print( 0, "Drill report for %s\n", TO_UTF8( brdFilename ) ); out.Print( 0, "Created on %s\n\n", TO_UTF8( DateAndTime() ) ); // Output the cu layer stackup, so layer name references make sense. out.Print( 0, "Copper Layer Stackup:\n" ); out.Print( 0, separator ); LSET cu = m_pcb->GetEnabledLayers() & LSET::AllCuMask(); int conventional_layer_num = 1; for( LSEQ seq = cu.Seq(); seq; ++seq, ++conventional_layer_num ) { out.Print( 0, " L%-2d: %-25s %s\n", conventional_layer_num, TO_UTF8( m_pcb->GetLayerName( *seq ) ), layerName( *seq ).c_str() // generic layer name ); } out.Print( 0, "\n\n" ); /* output hole lists: * 1 - through holes * 2 - for partial holes only: by layer starting and ending pair * 3 - Non Plated through holes */ bool buildNPTHlist = false; // First pass: build PTH list only // in this loop are plated only: for( unsigned pair_ndx = 0; pair_ndx < hole_sets.size(); ++pair_ndx ) { DRILL_LAYER_PAIR pair = hole_sets[pair_ndx]; buildHolesList( pair, buildNPTHlist ); if( pair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) ) { out.Print( 0, "Drill file '%s' contains\n", TO_UTF8( getDrillFileName( pair, false, m_merge_PTH_NPTH ) ) ); out.Print( 0, " plated through holes:\n" ); out.Print( 0, separator ); totalHoleCount = printToolSummary( out, false ); out.Print( 0, " Total plated holes count %u\n", totalHoleCount ); } else // blind/buried { out.Print( 0, "Drill file '%s' contains\n", TO_UTF8( getDrillFileName( pair, false, m_merge_PTH_NPTH ) ) ); out.Print( 0, " holes connecting layer pair: '%s and %s' (%s vias):\n", TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.first ) ) ), TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.second ) ) ), pair.first == F_Cu || pair.second == B_Cu ? "blind" : "buried" ); out.Print( 0, separator ); totalHoleCount = printToolSummary( out, false ); out.Print( 0, " Total plated holes count %u\n", totalHoleCount ); } out.Print( 0, "\n\n" ); } // NPTHoles. Generate the full list (pads+vias) if PTH and NPTH are merged, // or only the NPTH list (which never has vias) if( !m_merge_PTH_NPTH ) buildNPTHlist = true; buildHolesList( DRILL_LAYER_PAIR( F_Cu, B_Cu ), buildNPTHlist ); // nothing wrong with an empty NPTH file in report. if( m_merge_PTH_NPTH ) out.Print( 0, "Not plated through holes are merged with plated holes\n" ); else out.Print( 0, "Drill file '%s' contains\n", TO_UTF8( getDrillFileName( DRILL_LAYER_PAIR( F_Cu, B_Cu ), true, m_merge_PTH_NPTH ) ) ); out.Print( 0, " unplated through holes:\n" ); out.Print( 0, separator ); totalHoleCount = printToolSummary( out, true ); out.Print( 0, " Total unplated holes count %u\n", totalHoleCount ); return true; }
QString QgsLayerTreeLayer::dump() const { return QString( "LAYER: %1 visible=%2 expanded=%3 id=%4\n" ).arg( layerName() ).arg( mVisible ).arg( mExpanded ).arg( layerId() ); }
QgsMapLayer* QgsProjectParser::createLayerFromElement( const QDomElement& elem ) const { if ( elem.isNull() || !mXMLDoc ) { return 0; } QString uri; QString absoluteUri; QDomElement dataSourceElem = elem.firstChildElement( "datasource" ); if ( !dataSourceElem.isNull() ) { //convert relative pathes to absolute ones if necessary uri = dataSourceElem.text(); absoluteUri = convertToAbsolutePath( uri ); if ( uri != absoluteUri ) { QDomText absoluteTextNode = mXMLDoc->createTextNode( absoluteUri ); dataSourceElem.replaceChild( absoluteTextNode, dataSourceElem.firstChild() ); } } QString id = layerId( elem ); QgsMapLayer* layer = QgsMSLayerCache::instance()->searchLayer( absoluteUri, id ); if ( layer ) { //reading symbology every time is necessary because it could have been changed by a user SLD based request QString error; layer->readSymbology( elem, error ); return layer; } QString type = elem.attribute( "type" ); if ( type == "vector" ) { layer = new QgsVectorLayer(); } else if ( type == "raster" ) { layer = new QgsRasterLayer(); } else if ( elem.attribute( "embedded" ) == "1" ) //layer is embedded from another project file { QString project = convertToAbsolutePath( elem.attribute( "project" ) ); QgsDebugMsg( QString( "Project path: %1" ).arg( project ) ); QgsProjectParser* otherConfig = dynamic_cast<QgsProjectParser*>( QgsConfigCache::instance()->searchConfiguration( project ) ); if ( !otherConfig ) { return 0; } QMap< QString, QDomElement > layerMap = otherConfig->projectLayerElementsById(); QMap< QString, QDomElement >::const_iterator layerIt = layerMap.find( elem.attribute( "id" ) ); if ( layerIt == layerMap.constEnd() ) { return 0; } return otherConfig->createLayerFromElement( layerIt.value() ); } if ( layer ) { layer->readXML( const_cast<QDomElement&>( elem ) ); //should be changed to const in QgsMapLayer layer->setLayerName( layerName( elem ) ); QgsMSLayerCache::instance()->insertLayer( absoluteUri, id, layer ); } return layer; }
bool GraphicsInstance::createInstance(const char* appName, unsigned appVersion, const char* engineName, unsigned engineVersion) { ///////////////////////////////// // getting debug layers // TODO: These need to be saved for device creation also. which layers and extensions each use. std::vector<vk::LayerProperties> layersInfos; vk::enumerateInstanceLayerProperties(layersInfos); std::vector<const char*> layers; { // lunargvalidation list order F_LOG("Enabled Vulkan debug layers:\n"); for (auto&& it : layerOrder) { auto found = std::find_if(layersInfos.begin(), layersInfos.end(), [&](const vk::LayerProperties& layer) { return it == layer.layerName(); }); if (found != layersInfos.end()) { layers.push_back(it.c_str()); m_layers.push_back(*found); F_LOG("%s\n", found->layerName()); } } } ///////////////////////////////// // Getting extensions std::vector<vk::ExtensionProperties> extInfos; vk::enumerateInstanceExtensionProperties("", extInfos); std::vector<const char*> extensions; { // lunargvalidation list order F_LOG("Enabled Vulkan extensions:\n"); for (auto&& it : extOrder) { auto found = std::find_if(extInfos.begin(), extInfos.end(), [&](const vk::ExtensionProperties& layer) { return it == layer.extensionName(); }); if (found != extInfos.end()) { extensions.push_back(it.c_str()); m_extensions.push_back(*found); F_LOG("found %s\n", found->extensionName()); } } } ///////////////////////////////// // app instance app_info = vk::ApplicationInfo() .sType(vk::StructureType::eApplicationInfo) .pApplicationName(appName) .applicationVersion(appVersion) .pEngineName(engineName) .engineVersion(engineVersion) .apiVersion(VK_API_VERSION); instance_info = vk::InstanceCreateInfo() .sType(vk::StructureType::eInstanceCreateInfo) .pApplicationInfo(&app_info) .enabledLayerCount(static_cast<uint32_t>(layers.size())) .ppEnabledLayerNames(layers.data()) .enabledExtensionCount(static_cast<uint32_t>(extensions.size())) .ppEnabledExtensionNames(extensions.data()); vk::Result res = vk::createInstance(&instance_info, &m_alloc_info, m_instance.Get()); if (res != vk::Result::eSuccess) { // quite hot shit baby yeah! auto error = vk::getString(res); F_LOG("Instance creation error: %s\n", error.c_str()); return false; } m_devices = m_instance->enumeratePhysicalDevices(); // get addresses for few functions PFN_vkCreateDebugReportCallbackEXT dbgCreateDebugReportCallback; PFN_vkDestroyDebugReportCallbackEXT dbgDestroyDebugReportCallback; dbgCreateDebugReportCallback = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr( *m_instance.Get(), "vkCreateDebugReportCallbackEXT"); if (!dbgCreateDebugReportCallback) { F_LOG("GetInstanceProcAddr: Unable to find vkCreateDebugReportCallbackEXT function.");; return true; } dbgDestroyDebugReportCallback = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr( *m_instance.Get(), "vkDestroyDebugReportCallbackEXT"); if (!dbgDestroyDebugReportCallback) { F_LOG("GetInstanceProcAddr: Unable to find vkDestroyDebugReportCallbackEXT function.\n");; return true; } // the debug things auto flags = vk::DebugReportFlagBitsEXT::eError | vk::DebugReportFlagBitsEXT::eWarning | vk::DebugReportFlagBitsEXT::eDebug; vk::DebugReportCallbackCreateInfoEXT info = vk::DebugReportCallbackCreateInfoEXT(flags, debugCallback, nullptr); auto lol = m_instance; // callback needs to keep instance alive until its destroyed... so this works :DD auto allocInfo = m_alloc_info; m_debugcallback = FazPtrVk<vk::DebugReportCallbackEXT>([lol, allocInfo, dbgDestroyDebugReportCallback](vk::DebugReportCallbackEXT ist) { dbgDestroyDebugReportCallback(*lol.Get(), ist, reinterpret_cast<const VkAllocationCallbacks*>(&allocInfo)); }); dbgCreateDebugReportCallback(*m_instance.Get(), reinterpret_cast<const VkDebugReportCallbackCreateInfoEXT*>(&info), reinterpret_cast<const VkAllocationCallbacks*>(&m_alloc_info), reinterpret_cast<VkDebugReportCallbackEXT*>(m_debugcallback.Get())); return true; }