Skip to content

Commit cb80c6e

Browse files
committed
Подправил код
1 parent cc54673 commit cb80c6e

8 files changed

+17
-23
lines changed

MyMap.pro.user

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE QtCreatorProject>
3-
<!-- Written by QtCreator 4.11.0, 2021-07-01T00:25:00. -->
3+
<!-- Written by QtCreator 4.11.0, 2021-07-01T21:01:17. -->
44
<qtcreator>
55
<data>
66
<variable>EnvironmentId</variable>

drawfunctions.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace nDraw {
3636
}
3737
}
3838
else {
39-
39+
// Обработка трёхмерных координат (в рабочей карте нет)
4040
}
4141
}
4242
return result;
@@ -45,7 +45,7 @@ namespace nDraw {
4545
void DrawHydrography(QPainter& painter, const nSXFFile::rSXFFile &file) {
4646
static const int32_t CODES_COUNT = 9;
4747
static const int32_t HYDROGRAPHY_CODE[CODES_COUNT] = {31110000, 31120000, 31131000, 31132000, 31133000, 31134000,
48-
31135000, 31410000, 31431000};
48+
31135000, 31410000, 31431000}; // Классификационные коды объектов гидрографии из классификатора
4949
for (int32_t i = 0; i < file.m_descriptor.m_number_records_l; ++i) {
5050
bool find = false;
5151
for (int32_t j = 0; j < CODES_COUNT; ++j) {
@@ -61,13 +61,13 @@ namespace nDraw {
6161
painter.setPen(QPen(Qt::blue, 1, Qt::SolidLine));
6262
painter.setBrush(QBrush(Qt::cyan, Qt::SolidPattern));
6363
short localiz_type = file.m_records[i].m_title.LocalizationType();
64-
if (localiz_type == 0) {
64+
if (localiz_type == nSXFFile::eLocalType::LINEAR) {
6565
painter.drawPolyline(points.data(), points.size());
6666
}
67-
else if (localiz_type == 1) {
67+
else if (localiz_type == nSXFFile::eLocalType::AREAL) {
6868
painter.drawPolygon(points.data(), points.size());
6969
}
70-
else if (localiz_type == 2) {
70+
else if (localiz_type == nSXFFile::eLocalType::POINT) {
7171
painter.drawPoint(points[0]);
7272
}
7373
else {

rpassport.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
#include "rpassport.h"
33
#include <iostream>
44

5-
65
namespace nSXFFile {
7-
void rGeo_coord::Print() {
8-
std::cout << "B = " << this->m_b_d << " L = " << this->m_l_d << std::endl;
9-
}
106
void rPassport::Print() {
117
std::cout << "Паспортные данные файла: " << std::endl;
128
std::cout << "\tИдентификатор начала файла: " << std::hex << this->m_identifier_l << std::endl;

rpassport.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ namespace nSXFFile {
1919
struct rGeo_coord {
2020
double m_b_d;
2121
double m_l_d;
22-
void Print();
22+
void Print() {
23+
std::cout << "B = " << this->m_b_d << " L = " << this->m_l_d << std::endl;
24+
}
2325
};
2426

2527

rrecord.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ namespace nSXFFile {
99
std::cout << "\t\tИдентификатор начала записи: " << std::hex << this->m_identifier_l << std::endl;
1010
std::cout << "\t\tОбщая длина записи: " << std::dec << this->m_length_record_l << std::endl;
1111
std::cout << "\t\tДлина метрики: " << std::dec << this->m_length_metric_l << std::endl;
12-
std::cout << "\t\tКлассификационный код: " << std::dec << this->m_classification_code_l << std::endl; // В ШЕСТНАДЦАТЕР??
12+
std::cout << "\t\tКлассификационный код: " << std::dec << this->m_classification_code_l << std::endl;
1313
std::cout << "\t\tСобственный номер объекта: " << std::dec << this->m_object_number_l << std::endl;
14-
/*std::cout << "\t\t\tНомер в группе: " << std::dec << this->m_object_number_a_s[0] << std::endl;
15-
std::cout << "\t\t\tНомер группы: " << std::dec << this->m_object_number_a_s[1] << std::endl;*/
1614
std::cout << "\t\tСправочные данные: "; InformationFlagsPrint(this->m_reference_data_l);
1715
std::cout << "\t\tЧисло точек метрики: " << std::dec << this->m_count_metric_points << std::endl;
1816
std::cout << "\t\tОписатель метрики: " << std::endl;
@@ -49,7 +47,7 @@ namespace nSXFFile {
4947
return ((this->m_reference_data_l & METRIC_TEXT_POS) == METRIC_TEXT_POS ? true : false);
5048
}
5149
short rRecordTitle::LocalizationType() const {
52-
static const int32_t LOCALIZATION_TYPE_POS = (1 << 4) - 1;
50+
static const short LOCALIZATION_TYPE_POS = (1 << 4) - 1;
5351
return (this->m_reference_data_l & LOCALIZATION_TYPE_POS);
5452
}
5553

@@ -77,7 +75,7 @@ namespace nSXFFile {
7775
}
7876
}
7977
else {
80-
78+
// Обработка точек метрики в трёхмерных координатах (в рабочей карте таких нет)
8179
}
8280
}
8381
if (this->m_title.HasMetricText()) { // Если в метрике имеется подпись

rrecord.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
#include <fstream>
44

55
namespace nSXFFile {
6+
enum eLocalType { LINEAR = 0, AREAL, POINT, SIGNATURE, VECTOR, SIGNATURE_TEMPLATE};
67
struct rRecordTitle {
78
int32_t m_identifier_l;
89
int32_t m_length_record_l;
910
int32_t m_length_metric_l;
1011
int32_t m_classification_code_l;
11-
//short m_object_number_a_s[2]; // В ПАНАРАМЕ НОМЕР ЭТО ОДНО ЧИСЛО???
1212
int32_t m_object_number_l;
1313
uint32_t m_reference_data_l;
1414
int32_t m_count_metric_points;
@@ -25,7 +25,7 @@ namespace nSXFFile {
2525
};
2626
struct rRecord {
2727
rRecordTitle m_title;
28-
void* m_points; // ПОМЕНЯТЬ НА UNSIGNED LONG и UNSIGNED SHORT (см. диапазон значений координат)
28+
void* m_points;
2929
char* m_str_text; // Текст подписи (если имеется)
3030
char* m_semantics; // Считывается целиком, в данной версии программы не обрабатывается
3131
char* m_subobjects; // Считывается целиком, в данной версии программы не обрабатывается

rsxffile.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace nSXFFile {
99
void rSXFFile::Print() {
1010
this->m_passport.Print();
1111
this->m_descriptor.Print();
12-
//this->m_records[TEST - 1].Print();
1312
for (int i = TEST1; i < TEST2; ++i) { // ПОМЕНЯТЬ РАЗМЕР
1413
if (this->m_records[i].m_title.m_object_number_l == 16777794) { // ВНИМАНИЕ!
1514
std::cout << std::endl << "Информация о считанной записи №" << i + 1 << ": " << std::endl;
@@ -20,15 +19,13 @@ namespace nSXFFile {
2019
}
2120
void rSXFFile::Read(const char* p_str_filename) {
2221
std::ifstream in(p_str_filename, std::ios::binary);
23-
/*in.read((char*)&this->m_passport.m_identifier_l, sizeof(this->m_passport.m_identifier_l));
24-
std::cout << std::hex << this->m_passport.m_identifier_l << std::endl;*/
2522
in.read((char*)&this->m_passport, sizeof(this->m_passport));
2623
in.read((char*)&this->m_descriptor, sizeof(this->m_descriptor));
2724
this->m_records.resize(this->m_descriptor.m_number_records_l);
2825
for (int i = 0; i < this->m_descriptor.m_number_records_l; ++i) { // ПОМЕНЯТЬ РАЗМЕР
2926
in.read((char*)&this->m_records[i].m_title, sizeof(this->m_records[i].m_title));
3027
this->m_records[i].m_title.m_count_metric_points = this->m_records[i].m_title.m_metric_descriptor_a_s[1]; // Перенести значение в основное поле (см. структуру заголовка)
31-
long s_sz = 0;
28+
int32_t s_sz = 0;
3229
/*Считывание метрики записи */
3330
if (!this->m_records[i].m_title.Has3DPresentation()) {
3431
if (!this->m_records[i].m_title.HasDoubleMetricType() && !this->m_records[i].m_title.HasBigMetricSize()) {
@@ -62,7 +59,7 @@ namespace nSXFFile {
6259

6360
/*Считывание подобъектов (если имеются) */
6461
if (this->m_records[i].m_title.m_metric_descriptor_a_s[0] != 0) {
65-
long l_length_ost = m_records[i].m_title.m_length_metric_l - s_sz * this->m_records[i].m_title.m_count_metric_points; // ВНИМАНИЕ! СЧИТЫВАЕТ ГРАФИЧЕСКОЕ ОПИСАНИЕ ОБЪЕКТА ТУДА ЖЕ
62+
int32_t l_length_ost = m_records[i].m_title.m_length_metric_l - s_sz * this->m_records[i].m_title.m_count_metric_points; // ВНИМАНИЕ! СЧИТЫВАЕТ ГРАФИЧЕСКОЕ ОПИСАНИЕ ОБЪЕКТА ТУДА ЖЕ
6663
this->m_records[i].m_subobjects = new char[l_length_ost];
6764
in.read(this->m_records[i].m_subobjects, l_length_ost);
6865
}

rsxffile.h

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "rpassport.h"
44
#include "rrecord.h"
55
#include <vector>
6+
67
namespace nSXFFile {
78
struct rSXFFile {
89
rPassport m_passport;

0 commit comments

Comments
 (0)