You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.0 KiB
C++

#include "symbolresources.h"
#include "translator.h"
#include <QDebug>
SymbolResources::SymbolResources()
{
}
void SymbolResources::setResources(UGResources *resources)
{
this->resources = resources;
}
//重新载入符号库
void SymbolResources::reLoading()
{
// UGString marker2DPath = _U("D:/supermap-iobjectscpp/MyProject/MapDisplay/Symbol/MarkerLib2D.sym");
// const UGString line2DPath = _U("D:/supermap-iobjectscpp/MyProject/MapDisplay/Symbol/LineLib2D.lsl");
// const UGString fill2DPath = _U("D:/supermap-iobjectscpp/MyProject/MapDisplay/Symbol/FillLib2D.bru");
UGString marker2DPath = _U("D:/Symbol/MarkerLib2D.sym");
UGString line2DPath = _U("D:/Symbol/LineLib2D.lsl");
UGString fill2DPath = _U("D:/Symbol/FillLib2D.bru");
UGMarkerSymbolLib* ms = resources->GetMarkerSymbolLib();
// bool s = ms->AppendFromFile(marker2DPath,true);
bool s = ms->LoadFromFile(marker2DPath);
// qDebug()<<"***********s:"<<s;
// qDebug()<<"***********msCount:"<<ms->GetSymbolCount();
UGLineSymbolLib* ls = resources->GetLineSymbolLib();
bool s1 = ls->LoadFromFile(line2DPath);
// qDebug()<<"***********s1:"<<s1;
// qDebug()<<"***********msCount:"<<ls->GetSymbolCount();
UGFillSymbolLib* fs = resources->GetFillSymbolLib();
bool s2 = fs->LoadFromFile(fill2DPath);
// qDebug()<<"***********s2:"<<s2;
// qDebug()<<"***********msCount:"<<fs->GetSymbolCount();
ms = NULL;
ls = NULL;
fs = NULL;
}
void SymbolResources::addSymbol()
{
UGString symbolPath = _U("D:/Symbol/Plane.sym");
UGMarkerSymbolLib* ms = new UGMarkerSymbolLib();
bool ss = ms->LoadFromFile(symbolPath);
qDebug()<<"***********msCount:"<<ms->GetSymbolCount();
for(int i = 0;i<ms->GetSymbolCount();i++)
{
resources->GetMarkerSymbolLib()->AddSymbol(ms->GetSymbolAt(i));
}
// qDebug()<<"***********msCount:"<<resources->GetMarkerSymbolLib()->GetSymbolCount();
// bool s = resources->GetMarkerSymbolLib()->IsIDExisted(253268);
// qDebug()<<"***********s2:";
// delete ms;
}