Permalink
Browse files

Merge branch 'master' of github.com:dotevo/Pilocik

  • Loading branch information...
2 parents 69e6fcc + 0df3e3d commit cc45aee0983d742d0ee320d862e01df4c5c7ba11 @elsejwier elsejwier committed Dec 4, 2011
@@ -174,7 +174,7 @@ QList<Poi> PoiFilePPOI::loadPoisInType(QDataStream &inData,int position,int type
inData.readRawData(n,(int)nameS);
QString name=QString::fromUtf8(n,nameS);
delete []n;
- name.resize(nameS);
+ //name.resize(nameS);
//Tags
quint8 tagsC;
@@ -187,7 +187,7 @@ QList<Poi> PoiFilePPOI::loadPoisInType(QDataStream &inData,int position,int type
int sizeL=inData.readRawData(tagChar,(int)tagSize);
QString tag=QString::fromUtf8(tagChar,sizeL);
delete []tagChar;
- tag.resize(tagSize);
+ //tag.resize(tagSize);
QStringList tagList=tag.split('=');
if(tagList.count()==2){
QPair <QString,QString> dupa(tagList.at(0),tagList.at(1));
@@ -369,9 +369,10 @@ void PoiFilePPOI::makeBlock(QDataStream &stream,QVector<Poi*>*data,int types){
QListIterator <QPair<QString,QString > > tagsIter(list);
while(tagsIter.hasNext()){
QPair<QString,QString> pair=tagsIter.next();
- QString valueP=pair.first+"="+pair.second;
- out<<((quint8)valueP.length());
+ QString valueP=pair.first+"="+pair.second;
QByteArray aZ=valueP.toUtf8();
+ out<<((quint8)aZ.size());
+ qDebug()<<"valueP:"<<valueP.length()<<":"<<"s"<<aZ.size();
out.writeRawData(aZ.data(),aZ.size());
}
}
View
@@ -11,120 +11,10 @@
#include <pilibocik/geohash.h>
int main(int argc, char *argv[])
-{
- /*
+{
QApplication a(argc, argv);
MainWindow w;
w.show();
- return a.exec();*/
-/*
- {
-=======
-
-// POI SAVE
- QList<PiLibocik::Poi> pois;
- QList < QPair <QString, QString> > tags;
- QString geo1=PiLibocik::Geohash::generateGeohash(20,10,5);
- PiLibocik::Poi poi(20,10,QString::fromUtf8("ąasdęś"),0,tags,geo1);
- qDebug()<<"POI:"<<poi.getName();
- pois.append(poi);
- QString geo2=PiLibocik::Geohash::generateGeohash(19.1,10.0,5);
- PiLibocik::Poi poi2(10.1,10,QString::fromUtf8("Kąpłęta"),0,tags,geo2);
- pois.append(poi2);
- QMap<int,QString> types;
- types.insert(0,QString::fromUtf8("ędłę"));
- PiLibocik::PoiFilePPOI ppo;
- ppo.saveToFile("poi",pois,types);
-
-
- PiLibocik::PoiFilePPOI n;
- PiLibocik::BoundaryBox b(PiLibocik::Position(20,10),PiLibocik::Position(20,10));
- QTime t;
- t.start();
- QList <PiLibocik::Poi> p=n.loadPOIsFromFile("poi",b,-1);
- QListIterator <PiLibocik::Poi> iter(p);
- int i = 0;
- while(iter.hasNext()){
- PiLibocik::Poi poi=iter.next();
- i++;
- qDebug()<<poi.getLat()<<":"<<poi.getLon()<<" Name:"<<poi.getName()<<" Type:"<<poi.getType()<<"Geohash:"<<poi.getGeohash();
- QList < QPair <QString,QString > > l= poi.getTags();
- QListIterator <QPair <QString,QString > > iter2(l);
- while(iter2.hasNext()){
- QPair <QString,QString > n=iter2.next();
- qDebug()<<n.first<<"="<<n.second;
- }
- }
- qDebug()<<"Time: "<<t.elapsed()<<"Size: "<<i;
-
-
-
-
- /* {
-
->>>>>>> Plugins
- //Tworzenie przyk3adowych danych
- QList <PiLibocik::Partition::Node> nodes;
- PiLibocik::Partition::Way w(1,0.5,(quint8)0);
- PiLibocik::Partition::Way w2(2,0.5,(quint8)0);
- //Dodaj 10node do drogi 1
- for(int i=0;i<10;i++){
- PiLibocik::Partition::Node n(i, 100,0.1*i+0.1,0.1*i+0.1);
- PiLibocik::Partition::Edge e1( (i+1)%10, 0.1 );
- PiLibocik::Partition::BoundaryEdge b1((i+4)%10,1,0.5);
- //PiLibocik::Partition::Edge e2
- n.addRoutingEdge(e1);
- n.addBoundaryEdge(b1);
- n.addWay(0);
-
- w.addNode(i);
- if(i%2==0){
- n.addWay(1);
- w2.addNode(i);
- }
- nodes.append(n);
-
- }
- PiLibocik::Partition::PartitionFile p("test","car",QIODevice::WriteOnly,1);
- QList <PiLibocik::Partition::Way> ways;
- ways.append(w);
- ways.append(w2);
- p.savePartition(ways,nodes,4);
-<<<<<<< HEAD
- }*/
-
- PiLibocik::Partition::PartitionFile p("","car",QIODevice::ReadOnly,1);
- //Wroc³aw 51.118552&lon=17.057824
- PiLibocik::Partition::Node n=p.getNearestNode(PiLibocik::Position(17.05,51.11));
- qDebug()<<n.getId()<<" POS:"<<n.getLon()<<":"<<n.getLat();
-
-
- /*PiLibocik::BoundaryBox bbox(PiLibocik::Position(17.0,51),PiLibocik::Position(18,52));
-=======
- }
- PiLibocik::Partition::PartitionFile p("test","car",QIODevice::ReadOnly,1);
- PiLibocik::BoundaryBox bbox(PiLibocik::Position(0.1,0.1),PiLibocik::Position(1.5,1.5));
->>>>>>> Plugins
- QList<PiLibocik::Partition::Node> n=p.getNodesFromBoundaryBox(bbox);
- qDebug()<<n.length()<<"LL";
- QListIterator<PiLibocik::Partition::Node> iter(n);
- while(iter.hasNext()){
- PiLibocik::Partition::Node n=iter.next();
- QVector<PiLibocik::Partition::Way> ways=n.getWaysObj();
- qDebug()<<"NODE ID"<<n.getId()<<" ways:"<<ways.size();
- for(int i=0;i<ways.size();i++){
- PiLibocik::Partition::Way w=ways.at(i);
- qDebug()<<" Droga "<<w.getId()<<"z"<<ways.size()<<"w"<<n.getId();
- QVector<PiLibocik::Partition::Node> nodes=w.getNodesObj();
- for(int j=0;j<nodes.size();j++){
- PiLibocik::Partition::Node nnn=nodes.at(j);
- qDebug()<<" NODE"<<nnn.getId()<<":"<<nnn.getCell()<<";"<<nnn.getLon()<<":"<<nnn.getLat();
- }
- }
-<<<<<<< HEAD
- }*/
-
-
- return 0;
+ return a.exec();
}
@@ -13,7 +13,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui(new Ui::MainWindow)
{
ui->setupUi(this);
- PiLibocik::PrepareData* pd = new PiLibocik::PrepareData("g:/_poland.db","../test/config.xml");
+ // PiLibocik::PrepareData* pd = new PiLibocik::PrepareData("g:/_poland.db","../test/config.xml");
//------------SAVE-----------------
// PiLibocik::PrepareData* pd = new PiLibocik::PrepareData("g:/poi.db");
@@ -59,6 +59,46 @@ MainWindow::MainWindow(QWidget *parent) :
qDebug()<<g.toQString();
}*/
+
+
+ // POI SAVE
+ QList<PiLibocik::Poi> pois;
+ QList < QPair <QString, QString> > tags;
+ tags.append(QPair<QString,QString>("name",QString::fromUtf8("ąKłę")));
+ QString geo1=PiLibocik::Geohash::generateGeohash(20,10,5);
+ PiLibocik::Poi poi(20,10,QString::fromUtf8("ąasdęś"),0,tags,geo1);
+ qDebug()<<"POI:"<<poi.getName();
+ pois.append(poi);
+ QString geo2=PiLibocik::Geohash::generateGeohash(19.1,10.0,5);
+ PiLibocik::Poi poi2(10.1,10,QString::fromUtf8("Kąpłęta"),0,tags,geo2);
+ pois.append(poi2);
+ QMap<int,QString> types;
+ types.insert(0,QString::fromUtf8("ędłę"));
+ PiLibocik::PoiFilePPOI ppo;
+ ppo.saveToFile("poi",pois,types);
+
+ ui->label->setText("");
+ PiLibocik::PoiFilePPOI n;
+ PiLibocik::BoundaryBox b(PiLibocik::Position(20,10),PiLibocik::Position(20,10));
+ QTime t;
+ t.start();
+ QList <PiLibocik::Poi> p=n.loadPOIsFromFile("poi",b,-1);
+ QListIterator <PiLibocik::Poi> iter(p);
+ int i = 0;
+ while(iter.hasNext()){
+ PiLibocik::Poi poi=iter.next();
+ i++;
+ ui->label->setText(ui->label->text()+":"+poi.getName());
+ QList < QPair <QString,QString > > l= poi.getTags();
+ QListIterator <QPair <QString,QString > > iter2(l);
+ while(iter2.hasNext()){
+ QPair <QString,QString > n=iter2.next();
+ ui->label->setText(ui->label->text()+"->"+n.first+"="+n.second);
+ qDebug()<<n.first<<"="<<n.second;
+ }
+ }
+ qDebug()<<"Time: "<<t.elapsed()<<"Size: "<<i;
+
}
MainWindow::~MainWindow()
@@ -1,24 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow" >
- <property name="geometry" >
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>MainWindow</string>
</property>
- <widget class="QMenuBar" name="menuBar" />
- <widget class="QToolBar" name="mainToolBar" />
- <widget class="QWidget" name="centralWidget" />
- <widget class="QStatusBar" name="statusBar" />
+ <widget class="QWidget" name="centralWidget">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menuBar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>20</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QToolBar" name="mainToolBar">
+ <attribute name="toolBarArea">
+ <enum>TopToolBarArea</enum>
+ </attribute>
+ <attribute name="toolBarBreak">
+ <bool>false</bool>
+ </attribute>
+ </widget>
+ <widget class="QStatusBar" name="statusBar"/>
</widget>
- <layoutDefault spacing="6" margin="11" />
- <pixmapfunction></pixmapfunction>
+ <layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

0 comments on commit cc45aee

Please sign in to comment.