diff --git a/.gitignore b/.gitignore index 046dd6f..233b589 100644 --- a/.gitignore +++ b/.gitignore @@ -101,6 +101,7 @@ StyleCopReport.xml **.tlog *.tlog *.idb +*.sqlite # Chutzpah Test files _Chutzpah* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c5b0117 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "BaseCommonLibrary"] + path = BaseCommonLibrary + url = http://172.16.0.12:5000/LAMPSARToolSoftware/BaseCommonLibrary.git diff --git a/BaseCommonLibrary b/BaseCommonLibrary new file mode 160000 index 0000000..1f8567d --- /dev/null +++ b/BaseCommonLibrary @@ -0,0 +1 @@ +Subproject commit 1f8567dcc3220156be3416efbd75fbc18be691b2 diff --git a/BaseCommonLibrary/BaseCommonLibrary.qtvscr b/BaseCommonLibrary/BaseCommonLibrary.qtvscr deleted file mode 100644 index 718b3df..0000000 --- a/BaseCommonLibrary/BaseCommonLibrary.qtvscr +++ /dev/null @@ -1,429 +0,0 @@ - - -
- - - Qt Visual Studio Tools - - - Project Format Conversion - - - Report generated on 2025-02-02 17:23:02 - -
-
- - Files - - - - - [Before] - [After] - - [Diff before/after] - - - [Diff before/current] - - - [Diff after/current] - - - -
-
- - Changes - - - - - - - - - - - - - - - - - - - - - - - - - - - true]]> - - - - - - - - - - - - - true]]> - - - - - - - - - - - - - true]]> - - - - - - - - - - - - - true]]> - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - QtVS_v304]]> - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - $(MSBuildProjectDirectory)\QtMsBuild]]> - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - ]]> - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - ]]> - - - - - - - - - - ]]> - - - - - - - - - - ]]> - - - - - - - - - - ]]> - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - ]]> - - - - - - - - - - ]]> - - - - - - - - - - ]]> - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - ]]> - - - - - - - - - - - - - ]]> - - - - - - - - - - - - - ]]> - - - - - - - - - - - - - ]]> - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - ]]> - - - - -
-
-
- -
-
- diff --git a/BaseCommonLibrary/BaseCommonLibrary.vcxproj b/BaseCommonLibrary/BaseCommonLibrary.vcxproj deleted file mode 100644 index 002db1e..0000000 --- a/BaseCommonLibrary/BaseCommonLibrary.vcxproj +++ /dev/null @@ -1,324 +0,0 @@ - - - - - Debug - ARM - - - Debug - Win32 - - - Release - ARM - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - Win32Proj - {872ecd6f-30e3-4a1b-b17c-15e87d373ff6} - BaseCommonLibrary - 10.0 - QtVS_v304 - $(MSBuildProjectDirectory)\QtMsBuild - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - true - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - true - Unicode - - - DynamicLibrary - false - v143 - true - Unicode - - - - - core;gui;widgets - - - core;gui;widgets - - - core;gui;widgets - - - core;gui;widgets - - - core;xml;sql;opengl;gui;svg;xmlpatterns;widgets;location;positioning;openglextensions;charts - false - tools_qt5 - - - core;xml;sql;opengl;gui;svg;xmlpatterns;widgets;location;positioning;openglextensions;charts - false - tools_qt5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ./BaseTool;$(IncludePath) - true - true - - - ./BaseTool;$(IncludePath) - true - true - - - - Level3 - true - WIN32;_DEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - pch.h - true - - - Windows - true - false - - - - - Level3 - true - true - true - WIN32;NDEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - pch.h - true - - - Windows - true - true - true - false - - - - - Level3 - true - _DEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - NotUsing - pch.h - true - - - Windows - true - false - - - - - Level3 - true - _DEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - NotUsing - pch.h - true - - - Windows - true - false - - - - - Level3 - true - true - true - NDEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;BASECONSTVARIABLE_API;_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING;%(PreprocessorDefinitions) - true - NotUsing - pch.h - true - true - NoExtensions - true - stdcpp14 - stdc11 - true - false - MaxSpeed - - - Windows - true - true - DebugFull - false - - - true - compute_82,sm_82 - - - - - Level3 - true - true - true - NDEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;BASECONSTVARIABLE_API;_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING;%(PreprocessorDefinitions) - true - NotUsing - pch.h - true - true - StreamingSIMDExtensions2 - true - stdcpp14 - stdc11 - - - Windows - true - true - DebugFull - false - - - true - compute_82,sm_82 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - Create - Create - Create - Create - Create - - - - - - - - - - \ No newline at end of file diff --git a/BaseCommonLibrary/BaseCommonLibrary.vcxproj.filters b/BaseCommonLibrary/BaseCommonLibrary.vcxproj.filters deleted file mode 100644 index 74f915b..0000000 --- a/BaseCommonLibrary/BaseCommonLibrary.vcxproj.filters +++ /dev/null @@ -1,139 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {bf5c3550-65f6-4dad-9908-26690551ffad} - - - {4233f4e2-0d0f-4cf9-8722-367d80339b2c} - - - - - 头文件 - - - 头文件 - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - - - 源文件 - - - 源文件 - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - ToolAbstract - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - BaseTool - - - - - ToolAbstract - - - BaseTool - - - - - BaseTool - - - \ No newline at end of file diff --git a/BaseCommonLibrary/BaseTool/BaseConstVariable.h b/BaseCommonLibrary/BaseTool/BaseConstVariable.h deleted file mode 100644 index 67114db..0000000 --- a/BaseCommonLibrary/BaseTool/BaseConstVariable.h +++ /dev/null @@ -1,361 +0,0 @@ -#pragma once - -#ifndef BASECONSTVARIABLE_H -#define BASECONSTVARIABLE_H -//#define EIGEN_USE_MKL_ALL -//#define EIGEN_NO_DEBUG - - - -#ifdef BASECONSTVARIABLE_API -#define BASECONSTVARIABLEAPI __declspec(dllexport) -#else -#define BASECONSTVARIABLEAPI __declspec(dllimport) -#endif - - - -/** 定义常见文件格式*********/ -#define ENVI_FILE_FORMAT_FILTER u8"ALL File(*.*);;ENVI Bin(*.bin);;ENVI Data(*.dat);;ENVI Data(*.data);;tiff影像(*.tif);;tiff影像(*.tiff)" -#define XML_FILE_FORMAT_FILTER u8"ALL File(*.*);;XML File(*.xml);;tiff影像(*.tiff)" - - -// -//#define EIGEN_USE_BLAS -//#define EIGEN_USE_LAPACK -//#define EIGEN_VECTORIZE_SSE2 - -//#define DEBUGSHOWDIALOG - -#define __CUDANVCC___ // 定义CUDA函数 - -#define __PRFDEBUG__ -//#define __PRFDEBUG_PRFINF__ -//#define __ECHOTIMEDEBUG__ - -#define __TBPIMAGEDEBUG__ - -//#include -#include -#include -#include -#include - -/** 打印时间 ***************************************************************/ -inline char* get_cur_time() { - static char s[20]; - time_t t; - struct tm* ltime; - time(&t); - ltime = localtime(&t); - strftime(s, 20, "%Y-%m-%d %H:%M:%S", ltime); - return s; -} - -#define PRINT(fmt, ...) printf("%s " fmt, get_cur_time(), ##__VA_ARGS__); - - - - -#define MATPLOTDRAWIMAGE - - -#define r2d 180/3.141592653589793238462643383279 -#define d2r 3.141592653589793238462643383279/180 -#define LIGHTSPEED 299792458 -#define PRECISIONTOLERANCE 1e-6 -#define Radians2Degrees(Radians) Radians*PI_180 -#define Degrees2Radians(Degrees) Degrees*T180_PI -#define EARTHWE 0.000072292115 -#define PI 3.141592653589793238462643383279 - -#define WGS84_A 6378137.0 // 长半轴 (m) -#define WGS84_F (1.0/298.257223563) -#define WGS84_B (WGS84_A*(1-WGS84_F)) // 短半轴 (m) - - -#define earthRoute 0.000072292115 -#define Memory1GB 1073741824 -#define Memory1MB 1048576 -#define Memory1KB 1024 - -const std::complex imagI(0, 1); - - -const double epsilon = 0.000000000000001; -const double pi = 3.14159265358979323846; - - -const double a = 6378137.0; //椭球长半轴 -const double ae = 6378137.0; //椭球长半轴 -const double ee = 0.0818191910428;// 第一偏心率 -const double f_inverse = 298.257223563; //扁率倒数 -const double b = a - a / f_inverse; -const double eSquare = (a * a - b * b) / (a * a); -const double e = sqrt(eSquare); -const double earth_Re = 6378136.49; -const double earth_Rp = (1 - 1 / f_inverse) * earth_Re; -const double earth_We = 0.000072292115; - -/*********************************************** openMap参数 ********************************************************************/ -static long Paral_num_thread = 14; - - -/*********************************************** 基础枚举 ********************************************************************/ - -enum POLARTYPEENUM { // 极化类型 - POLARHH, - POLARHV, - POLARVH, - POLARVV, - POLARUNKOWN -}; - - -/*********************************************** 基础结构体区域 ********************************************************************/ - -/// -/// 地理坐标点 -/// -struct Landpoint // 点 SAR影像的像素坐标; -{ - double lon; // 经度x lon pixel_col - double lat; // 纬度y lat pixel_row - double ati; // 高程z ati pixel_time -}; - -struct Point2 { - double x = 0; - double y = 0; -}; - - -struct Point3 { - double x = 0; - double y = 0; - double z = 0; - void setX(double ix) { x = ix; } - void setY(double iy) { y = iy; } - void setZ(double iz) { z = iz; } -}; - -struct Point_3d { - double x; - double y; - double z; -}; - - - -struct DemBox { - double min_lon; - double max_lon; - double min_lat; - double max_lat; -}; - -struct Vector3 { - double x, y, z; -}; - - -struct Vector3_single { - float x, y, z; -}; - - -/*********************************************** FEKO仿真参数 ********************************************************************/ -extern "C" struct SatellitePos { - double time; - double Px ; - double Py ; - double Pz ; - double Vx ; - double Vy ; - double Vz ; -}; - - -extern "C" struct SatelliteAntPos { - double time; // 0 - double Px; - double Py; - double Pz; - double Vx; - double Vy; - double Vz; //7 - double AntDirectX; - double AntDirectY; - double AntDirectZ; - double AVx; - double AVy; - double AVz;//13 - double ZeroAntDiectX; - double ZeroAntDiectY; - double ZeroAntDiectZ; - double lon; - double lat; - double ati; // 19 -}; - - -extern "C" struct PatternImageDesc { - long phinum; - long thetanum; - double startTheta; - double startPhi; - double dtheta; - double dphi; -}; - - -struct CUDA_AntSate_PtrList { - long PRF_len = 0; - double* h_antpx = nullptr, * d_antpx = nullptr; - double* h_antpy = nullptr, * d_antpy = nullptr; - double* h_antpz = nullptr, * d_antpz = nullptr; - double* h_antvx = nullptr, * d_antvx = nullptr; - double* h_antvy = nullptr, * d_antvy = nullptr; - double* h_antvz = nullptr, * d_antvz = nullptr; - double* h_antdirectx = nullptr, * d_antdirectx = nullptr; - double* h_antdirecty = nullptr, * d_antdirecty = nullptr; - double* h_antdirectz = nullptr, * d_antdirectz = nullptr; - double* h_antXaxisX = nullptr, * d_antXaxisX = nullptr; - double* h_antXaxisY = nullptr, * d_antXaxisY = nullptr; - double* h_antXaxisZ = nullptr, * d_antXaxisZ = nullptr; - double* h_antYaxisX = nullptr, * d_antYaxisX = nullptr; - double* h_antYaxisY = nullptr, * d_antYaxisY = nullptr; - double* h_antYaxisZ = nullptr, * d_antYaxisZ = nullptr; - double* h_antZaxisX = nullptr, * d_antZaxisX = nullptr; - double* h_antZaxisY = nullptr, * d_antZaxisY = nullptr; - double* h_antZaxisZ = nullptr, * d_antZaxisZ = nullptr; -}; - -/*********************************************** 卫星轨道坐标 ********************************************************************/ - - -/// -/// 轨道节点,坐标系统为WGS84 -/// -struct SatelliteOribtNode { - double time; - - double Px;// 位置 - double Py; - double Pz; - - double Vx;// 速度 - double Vy; - double Vz; - - double AVx; // 加速度 - double AVy; - double AVz; - - double AntXaxisX; // X天线指向,对应翻滚角等参数 - double AntXaxisY; // - double AntXaxisZ; // - - double AntYaxisX; // Y天线指向,对应翻滚角等参数 - double AntYaxisY; // - double AntYaxisZ; // - - double AntZaxisX; // Z天线指向,对应翻滚角等参数 - double AntZaxisY; // - double AntZaxisZ; // - - - double AntDirecX; // 天线指向,对应翻滚角等参数 - double AntDirecY; - double AntDirecZ; - - double zeroDopplerDirectX; // 0 多普勒方向 - double zeroDopplerDirectY; - double zeroDopplerDirectZ; - - double beamAngle; // 波位角 - double AzAngle;// 摆动角 - - -}; - - -struct SatelliteAntDirect { - double Xst; // 地面-->卫星矢量 - double Yst; - double Zst; - double Vxs; // 卫星速度 - double Vys; - double Vzs; - - double Xant; // 天线坐标系下的 矢量坐标 - double Yant; - double Zant; - - double Norm; - - double ThetaAnt; // 天线坐标系下的 theta 坐标系 - double PhiAnt; -}; - - - -struct RadiationPatternGainPoint { - double theta; - double phi; - double GainValue; -}; - - - - -/*********************************************** 指针回收区域 ********************************************************************/ - -inline void delArrPtr(void* p) -{ - if (nullptr == p || NULL == p) { - return; - } - delete[] p; - p = nullptr; -}; - -inline void delPointer(void* p) -{ - if (nullptr == p || NULL == p) { - return; - } - delete p; - p = nullptr; -}; - -inline void PrintTime() { - time_t current_time; - time(¤t_time); - printf("Current timestamp in seconds: %ld\n", (long)current_time); -}; - -/** 计算分块 ******************************************************************/ - -inline long getBlockRows(long sizeMB, long cols, long sizeMeta, long maxRows) { - long rownum = (round(Memory1MB * 1.0 / sizeMeta / cols * sizeMB) + cols - 1); - rownum = rownum < 0 ? 1 : rownum; - rownum = rownum < maxRows ? rownum : maxRows; - return rownum; -}; - - -inline long nextpow2(long n) { - long en = ceil(log2(n)); - return pow(2, en); -}; - -inline void releaseVoidArray(void* a) -{ - free(a); - a = NULL; -}; - - - -#endif \ No newline at end of file diff --git a/BaseCommonLibrary/BaseTool/BaseTool.cpp b/BaseCommonLibrary/BaseTool/BaseTool.cpp deleted file mode 100644 index 5ea4ed0..0000000 --- a/BaseCommonLibrary/BaseTool/BaseTool.cpp +++ /dev/null @@ -1,775 +0,0 @@ -#include "stdafx.h" -//#define EIGEN_USE_BLAS -#define EIGEN_VECTORIZE_SSE4_2 -//#include - -#include -#include -#include -#include -////#include - -#include -#include -#include < io.h > -#include < stdio.h > -#include < stdlib.h > -#include -#include -#include -//#include -#include //#include "ogrsf_frmts.h" - -#include -#include -#include "GeoOperator.h" - -#include -#include -#include "baseTool.h" - -#include // 多项式拟合 -#include /* 提供了 gammaq 函数 */ -#include /* 提供了向量结构*/ -#include -#include -#include - -#include // 包含SSE指令集头文件 -#include // 包含SSE2指令集头文件 -#include // 包含OpenMP头文件 -#include -#include -#include -#include - -QString longDoubleToQStringScientific(long double value) { - std::ostringstream stream; - - // 设置流的精度为35位有效数字,并使用科学计数法 - stream << std::scientific << std::setprecision(35) << value; - - // 将标准字符串转换为 QString - return QString::fromStdString(stream.str()); -} - -QString getCurrentTimeString() { - struct tm ConversionTime; - std::time_t t = std::time(NULL); - char mbstr[100]; - _localtime64_s(&ConversionTime, &t); - std::strftime(mbstr, sizeof(mbstr), "%Y-%m-%d %H:%M:%S", &ConversionTime); - QString strTime = mbstr; - return strTime; -} - -QString getCurrentShortTimeString() { - struct tm ConversionTime; - std::time_t t = std::time(NULL); - char mbstr[100]; - _localtime64_s(&ConversionTime, &t); - std::strftime(mbstr, sizeof(mbstr), "%Y-%m-%d %H:%M:%S", &ConversionTime); - QString strTime = mbstr; - return strTime; -} - -std::vector splitString(const QString& str, char delimiter) -{ - QStringList tokens = str.split(delimiter); - return convertQStringListToStdVector(tokens); -} - - -std::complex Cubic_Convolution_interpolation(double u, double v, Eigen::MatrixX> img) -{ - if (img.rows() != 4 || img.cols() != 4) { - throw std::exception("the size of img's block is not right"); - } - // 斤拷锟斤拷模锟斤拷 - Eigen::MatrixX> wrc(1, 4);// 使锟斤拷 complex 斤拷锟斤拷要原斤拷为锟剿伙拷取值 - Eigen::MatrixX> wcr(4, 1);// - for (int i = 0; i < 4; i++) { - wrc(0, i) = Cubic_kernel_weight(u + 1 - i); // u+1,u,u-1,u-2 - wcr(i, 0) = Cubic_kernel_weight(v + 1 - i); - } - - Eigen::MatrixX> interValue = wrc * img * wcr; - return interValue(0, 0); -} - -std::complex Cubic_kernel_weight(double s) -{ - s = abs(s); - if (s <= 1) { - return std::complex(1.5 * s * s * s - 2.5 * s * s + 1, 0); - } - else if (s <= 2) { - return std::complex(-0.5 * s * s * s + 2.5 * s * s - 4 * s + 2, 0); - } - else { - return std::complex(0, 0); - } -} - -/// -/// p11 p12 -- x -/// p0(u,v) -/// p21 p22 -/// | -/// y -/// p11(0,0) -/// p21(0,1) -/// P12(1,0) -/// p22(1,1) -/// -/// x,y,z -/// x,y,z -/// x,y,z -/// x,y,z -/// x,y,z -/// -double Bilinear_interpolation(Landpoint p0, Landpoint p11, Landpoint p21, Landpoint p12, Landpoint p22) -{ - return p11.ati * (1 - p0.lon) * (1 - p0.lat) + - p12.ati * p0.lon * (1 - p0.lat) + - p21.ati * (1 - p0.lon) * p0.lat + - p22.ati * p0.lon * p0.lat; -} - - - -bool onSegment(Point3 Pi, Point3 Pj, Point3 Q) -{ - if ((Q.x - Pi.x) * (Pj.y - Pi.y) == (Pj.x - Pi.x) * (Q.y - Pi.y) //叉乘 - //保证Q点坐标在pi,pj之间 - && std::min(Pi.x, Pj.x) <= Q.x && Q.x <= std::max(Pi.x, Pj.x) - && std::min(Pi.y, Pj.y) <= Q.y && Q.y <= std::max(Pi.y, Pj.y)) - return true; - else - return false; -} - -Point3 invBilinear(Point3 p, Point3 a, Point3 b, Point3 c, Point3 d) -{ - Point3 res; - - Point3 e = b - a; - Point3 f = d - a; - Point3 g = a - b + c - d; - Point3 h = p - a; - - double k2 = cross2d(g, f); - double k1 = cross2d(e, f) + cross2d(h, g); - double k0 = cross2d(h, e); - double u, v; - // if edges are parallel, this is a linear equation - if (abs(k2) < 0.001) - { - v = -k0 / k1; - u = (h.x - f.x * v) / (e.x + g.x * v); - p.z = a.z + (b.z - a.z) * u + (d.z - a.z) * v + (a.z - b.z + c.z - d.z) * u * v; - return p; - } - // otherwise, it's a quadratic - else - { - float w = k1 * k1 - 4.0 * k0 * k2; - if (w < 0.0) { - // 可能在边界上 - if (onSegment(a, b, p)) { - Point3 tt = b - a; - Point3 ttpa = p - a; - double scater = ttpa / tt; - if (scater < 0 || scater>1) { return { -9999,-9999,-9999 }; } - p.z = a.z + scater * tt.z; - return p; - } - else if (onSegment(b, c, p)) { - Point3 tt = c - b; - Point3 ttpa = p - b; - double scater = ttpa / tt; - if (scater < 0 || scater>1) { return { -9999,-9999,-9999 }; } - p.z = b.z + scater * tt.z; - return p; - } - else if (onSegment(c, d, p)) { - Point3 tt = d - c; - Point3 ttpa = p - c; - double scater = ttpa / tt; - if (scater < 0 || scater>1) { return { -9999,-9999,-9999 }; } - p.z = c.z + scater * tt.z; - return p; - } - else if (onSegment(d, a, p)) { - Point3 tt = a - d; - Point3 ttpa = p - d; - double scater = ttpa / tt; - if (scater < 0 || scater>1) { return { -9999,-9999,-9999 }; } - p.z = d.z + scater * tt.z; - return p; - } - - return { -9999,-9999,-9999 }; - } - else { - w = sqrt(w); - - float ik2 = 0.5 / k2; - float v = (-k1 - w) * ik2; - float u = (h.x - f.x * v) / (e.x + g.x * v); - - if (u < 0.0 || u>1.0 || v < 0.0 || v>1.0) - { - v = (-k1 + w) * ik2; - u = (h.x - f.x * v) / (e.x + g.x * v); - } - p.z = a.z + (b.z - a.z) * u + (d.z - a.z) * v + (a.z - b.z + c.z - d.z) * u * v; - return p; - } - } - p.z = a.z + (b.z - a.z) * u + (d.z - a.z) * v + (a.z - b.z + c.z - d.z) * u * v; - return p; -} - -double sind(double degree) -{ - return sin(degree * d2r); -} - -double cosd(double d) -{ - return cos(d * d2r); -} - - -std::string Convert(float Num) -{ - std::ostringstream oss; - oss << Num; - std::string str(oss.str()); - return str; -} - -QString JoinPath(const QString& path, const QString& filename) -{ - QDir dir(path); - - // Ensure the path ends with the appropriate separator - if (!QDir::isAbsolutePath(path)) - dir.makeAbsolute(); - - return dir.filePath(filename); -} -std::vector convertQStringListToStdVector(const QStringList& qStringList) -{ - std::vector stdVector; - - for (const QString& str : qStringList) { - stdVector.push_back(str); - } - - return stdVector; -}; - - -ErrorCode polyfit(const double* x, const double* y, int xyLength, int poly_n, std::vector& out_factor, double& out_chisq) { - /* - * x:自变量,视差 - * y:因变量,距离 - * xyLength: x、y长度 - * poly_n:拟合的阶次 - * out_factor:拟合的系数结果,从0阶到poly_n阶的系数 - * out_chisq:拟合曲线与数据点的优值函数最小值 ,χ2 检验 - */ - - gsl_matrix* XX = gsl_matrix_alloc(xyLength, poly_n + 1); - gsl_vector* c = gsl_vector_alloc(poly_n + 1); - gsl_matrix* cov = gsl_matrix_alloc(poly_n + 1, poly_n + 1); - gsl_vector* vY = gsl_vector_alloc(xyLength); - - for (size_t i = 0; i < xyLength; i++) - { - gsl_matrix_set(XX, i, 0, 1.0); - gsl_vector_set(vY, i, y[i]); - for (int j = 1; j <= poly_n; j++) - { - gsl_matrix_set(XX, i, j, pow(x[i], j)); - } - } - gsl_multifit_linear_workspace* workspace = gsl_multifit_linear_alloc(xyLength, poly_n + 1); - int r = gsl_multifit_linear(XX, vY, c, cov, &out_chisq, workspace); - gsl_multifit_linear_free(workspace); - out_factor.resize(c->size, 0); - for (size_t i = 0; i < c->size; ++i) - { - out_factor[i] = gsl_vector_get(c, i); - } - - gsl_vector_free(vY); - gsl_matrix_free(XX); - gsl_matrix_free(cov); - gsl_vector_free(c); - - return GSLState2ErrorCode(r); -} - -Point3 crossProduct(const Point3& a, const Point3& b) -{ - return Point3{ - a.y * b.z - a.z * b.y, // C_x - a.z * b.x - a.x * b.z, // C_y - a.x * b.y - a.y * b.x // C_z - }; -} - - - - -// 计算绕任意轴旋转的旋转矩阵 -Eigen::Matrix3d rotationMatrix(const Eigen::Vector3d& axis, double angle) { - // 确保旋转轴是单位向量 - Eigen::Vector3d u = axis.normalized(); - - double cos_theta = cos(angle); - double sin_theta = sin(angle); - - // 计算旋转矩阵 - Eigen::Matrix3d R; - R << - cos_theta + u.x() * u.x() * (1 - cos_theta), u.x()* u.y()* (1 - cos_theta) - u.z() * sin_theta, u.x()* u.z()* (1 - cos_theta) + u.y() * sin_theta, - u.y()* u.x()* (1 - cos_theta) + u.z() * sin_theta, cos_theta + u.y() * u.y() * (1 - cos_theta), u.y()* u.z()* (1 - cos_theta) - u.x() * sin_theta, - u.z()* u.x()* (1 - cos_theta) - u.y() * sin_theta, u.z()* u.y()* (1 - cos_theta) + u.x() * sin_theta, cos_theta + u.z() * u.z() * (1 - cos_theta); - - return R; -} - - - - - -long double convertToMilliseconds(const std::string& dateTimeStr) { - // 定义日期时间字符串 - std::string dateTimeString = dateTimeStr; - // 使用 Boost.Date_Time 解析日期时间字符串 - boost::posix_time::ptime dateTime = boost::posix_time::time_from_string(dateTimeString); - - // 将 ptime 转换为自 epoch (1970年1月1日) 以来的毫秒数 - boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); - boost::posix_time::time_duration duration = dateTime - epoch; - long double milliseconds = duration.total_milliseconds() / 1000.0; - return milliseconds; - -} - -long FindValueInStdVector(std::vector& list, double& findv) -{ - if (list.size() == 0) { - return -1; - } - else if (list.size() == 1) { - if (abs(list[0] - findv) < 1e-9) { - return 0; - } - else { - return -1; - } - } - else {} - - if (abs(list[0] - findv) < 1e-9) { - return 0; - } - else if (abs(list[list.size() - 1] - findv) < 1e-9) { - return list.size() - 1; - } - else if (list[0] > findv) { - return -1; - } - else if (list[list.size() - 1] < findv) { - return -1; - } - else {} - - - - long low = 0; - long high = list.size() - 1; - while (low <= high) { - long mid = (low + high) / 2; - if (abs(list[mid] - findv) < 1e-9) { - return mid; - } - else if (list[mid] < findv) { - low = mid + 1; - } - else if (list[mid] > findv) { - high = mid - 1; - } - else {} - } - return -1; -} - -long InsertValueInStdVector(std::vector& list, double insertValue, bool repeatValueInsert) -{ - if (list.size() == 0) { - list.insert(list.begin(), insertValue); - return 0; - } - else if (list.size() == 1) { - if (std::abs(list[0] - insertValue) < PRECISIONTOLERANCE) { - if (repeatValueInsert) { - list.push_back(insertValue); - return 1; - } - else { - return -1; - } - } - else if (insertValue > list[0]) { - list.push_back(insertValue); - return 1; - } - else if (insertValue < list[0]) { - list.push_back(insertValue); - return 0; - } - } - else { - long low = 0; - long high = list.size() - 1; - long mid = -1; - // 处理边界 - if (list[high] <= insertValue) - { - if (std::abs(list[high] - insertValue) < PRECISIONTOLERANCE) { - if (repeatValueInsert) { - list.push_back(insertValue); - } - else {} - } - else { - list.push_back(insertValue); - } - return list.size() - 1; - } - - if (list[low] >= insertValue) { - - if (std::abs(list[low] - insertValue) < PRECISIONTOLERANCE) { - if (repeatValueInsert) { - list.insert(list.begin(), insertValue); - } - else {} - } - else { - list.insert(list.begin(), insertValue); - } - return 0; - } - // low 1) { - mid = (low + high) / 2; - if (std::abs(list[mid] - insertValue) < PRECISIONTOLERANCE) { - if (repeatValueInsert) { - list.insert(list.begin() + mid, insertValue); - } - return mid; - } - else if (insertValue < list[mid]) { - high = mid; - } - else if (list[mid] < insertValue) { - low = mid; - } - - } - if (list[low] <= insertValue && insertValue <= list[high]) - { - - if (std::abs(list[high] - insertValue) < PRECISIONTOLERANCE) { - if (repeatValueInsert) { - list.insert(list.begin() + high, insertValue); - } - else {} - } - else { - list.insert(list.begin() + high, insertValue); - } - return low; - } - else { - return -1; - } - } - return -1; -} - -long FindValueInStdVectorLast(std::vector& list, double& insertValue) -{ - if (list.size() == 0 || list.size() == 1) { - return -1; - } - else { - long low = 0; - long high = list.size() - 1; - long mid = -1; - // 处理边界 - if (list[high]+ PRECISIONTOLERANCE < insertValue) - { - return -1; - } - else if (std::abs(list[high] - insertValue) < PRECISIONTOLERANCE) - { - return high; - } - else if (list[low] > insertValue) { - return -1; - } - else if (std::abs(list[low] - insertValue) < PRECISIONTOLERANCE) { - return low; - } - else {} - // low 1) { - mid = (low + high) / 2; - if (insertValue < list[mid]) { - high = mid; - } - else if (list[mid] < insertValue) { - low = mid; - } - else {// insertValue==list[mid] , list[mid]===insertValue - return mid;// - } - } - if (list[low] <= insertValue && insertValue <= list[high]) - { - return low; - } - else { - return -1; - } - } - return -1; -} - - -ErrorCode polynomial_fit(const std::vector& x, const std::vector& y, int degree, std::vector& out_factor, double& out_chisq) { - int xyLength = x.size(); - double* xdata = new double[xyLength]; - double* ydata = new double[xyLength]; - for (long i = 0; i < xyLength; i++) { - xdata[i] = x[i]; - ydata[i] = y[i]; - } - ErrorCode state = polyfit(xdata, ydata, xyLength, degree, out_factor, out_chisq); - - delete[] xdata; - delete[] ydata; // 释放内存 - return state; -} - -QVector SatellitePos2SatelliteAntPos(QVector poses) -{ - QVector antposes(poses.count()); - for (long i = 0; i < poses.count(); i++) { - antposes[i].time = poses[i].time; - antposes[i].Px = poses[i].Px; - antposes[i].Py = poses[i].Py; - antposes[i].Pz = poses[i].Pz; - antposes[i].Vx = poses[i].Vx; - antposes[i].Vy = poses[i].Vy; - antposes[i].Vz = poses[i].Vz; - } - return antposes; -} - -QVector SatelliteAntPos2SatellitePos(QVector poses) -{ - QVector antposes(poses.count()); - for (long i = 0; i < poses.count(); i++) { - antposes[i].time = poses[i].time; - antposes[i].Px = poses[i].Px; - antposes[i].Py = poses[i].Py; - antposes[i].Pz = poses[i].Pz; - antposes[i].Vx = poses[i].Vx; - antposes[i].Vy = poses[i].Vy; - antposes[i].Vz = poses[i].Vz; - } - return antposes; -} - - -QString getDebugDataPath(QString filename) -{ - QString folderName = "debugdata"; - QString appDir = QCoreApplication::applicationDirPath(); - QString folderpath = JoinPath(appDir, folderName); - if (!QDir(folderpath).exists()) { - QDir(appDir).mkdir(folderName); - } - QString datapath = JoinPath(folderpath, filename); - QFile datafile(datapath); - if (datafile.exists()) { - datafile.remove(); - } - return datapath; -} - - -std::vector split(const std::string& str, char delimiter) { - std::vector tokens; - std::string token; - std::istringstream tokenStream(str); - - while (std::getline(tokenStream, token, delimiter)) { - tokens.push_back(token); - } - - return tokens; -} - - -Eigen::VectorXd linspace(double start, double stop, int num) { - Eigen::VectorXd result(num); - - double step = (stop - start) / (num - 1); // 计算步长 - for (int i = 0; i < num; ++i) { - result[i] = start + i * step; // 生成等间距数值 - } - - return result; -} - -void initializeMatrixWithSSE2(Eigen::MatrixXd& mat, const double* data, long rowcount, long colcount) { - __m128d zero = _mm_setzero_pd(); - -#pragma omp parallel for - for (long i = 0; i < rowcount; ++i) { - for (long j = 0; j < colcount; j += 2) { // 每次处理2个double - if (j + 2 <= colcount) { - __m128d src = _mm_loadu_pd(&data[i * colcount + j]); - _mm_storeu_pd(&mat(i, j), src); - } - else { - // 处理剩余部分 - for (long k = j; k < colcount; ++k) { - mat(i, k) = data[i * colcount + k]; - } - } - } - } -} - -void initializeMatrixWithSSE2(Eigen::MatrixXf& mat, const float* data, long rowcount, long colcount) { - __m128 zero = _mm_setzero_ps(); - -#pragma omp parallel for - for (long i = 0; i < rowcount; ++i) { - for (long j = 0; j < colcount; j += 4) { // 每次处理4个float - if (j + 4 <= colcount) { - __m128 src = _mm_loadu_ps(&data[i * colcount + j]); - _mm_storeu_ps(&mat(i, j), src); - } - else { - // 处理剩余部分 - for (long k = j; k < colcount; ++k) { - mat(i, k) = data[i * colcount + k]; - } - } - } - } -} - -Eigen::MatrixXd BASECONSTVARIABLEAPI MuhlemanSigmaArray(Eigen::MatrixXd& eta_deg) -{ - Eigen::MatrixXd sigma = Eigen::MatrixXd::Zero(eta_deg.rows(), eta_deg.cols()); - for (long i = 0; i < sigma.rows(); i++) { - for (long j = 0; j < sigma.cols(); j++) { - sigma(i,j) = calculate_MuhlemanSigma(eta_deg(i, j)); - } - } - return sigma; -} - -Eigen::MatrixXd BASECONSTVARIABLEAPI dB2Amp(Eigen::MatrixXd& sigma0) -{ - Eigen::MatrixXd sigma = Eigen::MatrixXd::Zero(sigma0.rows(), sigma0.cols()); - for (long i = 0; i < sigma.rows(); i++) { - for (long j = 0; j < sigma.cols(); j++) { - sigma(i, j) =std::pow(10.0, sigma0(i,j)/20.0); - } - } - return sigma; -} - - - -QDateTime parseCustomDateTime(const QString& dateTimeStr) { - // 手动解析日期时间字符串 - int year = dateTimeStr.left(4).toInt(); - int month = dateTimeStr.mid(5, 2).toInt(); - int day = dateTimeStr.mid(8, 2).toInt(); - int hour = dateTimeStr.mid(11, 2).toInt(); - int minute = dateTimeStr.mid(14, 2).toInt(); - int second = dateTimeStr.mid(17, 2).toInt(); - int msec = dateTimeStr.mid(20, 6).toInt(); // 只取毫秒的前三位,因为QDateTime支持到毫秒 - - // 创建 QDate 和 QTime 对象 - QDate date(year, month, day); - QTime time(hour, minute, second, msec ); // 转换为微秒,但QTime只支持毫秒精度 - - // 构造 QDateTime 对象 - QDateTime result(date, time); - - return result; -} - - -bool isLeapYear(int year) { - return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); -} - -int daysInMonth(int year, int month) { - if (month == 2) return isLeapYear(year) ? 29 : 28; - else if (month == 4 || month == 6 || month == 9 || month == 11) return 30; - else return 31; -} - - -TimestampMicroseconds parseAndConvert( std::string dateTimeStr) { - // 解析年、月、日、时、分、秒和微秒 - int year = std::stoi(dateTimeStr.substr(0, 4)); - int month = std::stoi(dateTimeStr.substr(5, 2)); - int day = std::stoi(dateTimeStr.substr(8, 2)); - int hour = std::stoi(dateTimeStr.substr(11, 2)); - int minute = std::stoi(dateTimeStr.substr(14, 2)); - int second = std::stoi(dateTimeStr.substr(17, 2)); - int microsec = std::stoi(dateTimeStr.substr(20, 6)); - - // 计算从1970年至目标年份前一年的总天数 - long long totalDays = 0; - for (int y = 1970; y < year; ++y) { - totalDays += isLeapYear(y) ? 366 : 365; - } - - // 加上目标年份从1月到上一个月的天数 - for (int m = 1; m < month; ++m) { - totalDays += daysInMonth(year, m); - } - - // 加上本月的天数 - totalDays += day - 1; - - // 转换为总秒数,再加上小时、分钟、秒 - long long totalSeconds = totalDays * 24 * 60 * 60 + hour * 60 * 60 + minute * 60 + second; - - // 转换为毫秒和微秒 - long long msecsSinceEpoch = totalSeconds * 1000 + microsec / 1000; - int microseconds = microsec % 1000; - - return { msecsSinceEpoch, microseconds }; -} - - diff --git a/BaseCommonLibrary/BaseTool/BaseTool.h b/BaseCommonLibrary/BaseTool/BaseTool.h deleted file mode 100644 index 6ad57ff..0000000 --- a/BaseCommonLibrary/BaseTool/BaseTool.h +++ /dev/null @@ -1,226 +0,0 @@ -#pragma once -#ifndef BASETOOL_H -#define BASETOOL_H -#include "BaseConstVariable.h" - -/// -/// 基本类、基本函数 -/// - - -// //#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "GeoOperator.h" -#include -#include -#include -#include -#include "LogInfoCls.h" -#include -#include -#include -#include -#include -#include - -///////////////////////////////////// 基础数学函数 ///////////////////////////////////////////////////////////// - - -QString longDoubleToQStringScientific(long double value); - -///////////////////////////////////// 运行时间打印 ///////////////////////////////////////////////////////////// - - -QString BASECONSTVARIABLEAPI getCurrentTimeString(); -QString BASECONSTVARIABLEAPI getCurrentShortTimeString(); - -std::vector BASECONSTVARIABLEAPI splitString(const QString& str, char delimiter); -std::vector BASECONSTVARIABLEAPI convertQStringListToStdVector(const QStringList& qStringList); -/////////////////////////////// 基本图像类 结束 -///////////////////////////////////////////////////////////// - -std::string BASECONSTVARIABLEAPI Convert(float Num); -QString BASECONSTVARIABLEAPI JoinPath(const QString& path, const QString& filename); - -////////////////////////////// 坐标部分基本方法 ////////////////////////////////////////// - -////////////////////////////// 坐标部分基本方法 ////////////////////////////////////////// - -////////////////////////////// 插值 //////////////////////////////////////////// - -std::complex BASECONSTVARIABLEAPI Cubic_Convolution_interpolation(double u, double v, - Eigen::MatrixX> img); - -std::complex BASECONSTVARIABLEAPI Cubic_kernel_weight(double s); - -double BASECONSTVARIABLEAPI Bilinear_interpolation(Landpoint p0, Landpoint p11, Landpoint p21, Landpoint p12,Landpoint p22); - -bool BASECONSTVARIABLEAPI onSegment(Point3 Pi, Point3 Pj, Point3 Q); - -Point3 BASECONSTVARIABLEAPI invBilinear(Point3 p, Point3 a, Point3 b, Point3 c, Point3 d); - -// -// WGS84 到J2000 坐标系的变换 -// 参考网址:https://blog.csdn.net/hit5067/article/details/116894616 -// 资料网址:http://celestrak.org/spacedata/ -// 参数文件: -// a. Earth Orientation Parameter 文件: http://celestrak.org/spacedata/EOP-Last5Years.csv -// b. Space Weather Data 文件: http://celestrak.org/spacedata/SW-Last5Years.csv -// 备注:上述文件是自2017年-五年内 -/** -在wgs84 坐标系转到J2000 坐标系 主要 涉及到坐标的相互转换。一般给定的WGS坐标为 给定时刻的 t ,BLH -转换步骤: -step 1: WGS 84 转换到协议地球坐标系 -step 2: 协议地球坐标系 转换为瞬时地球坐标系 -step 3: 瞬时地球坐标系 转换为 瞬时真天球坐标系 -step 4: 瞬时真天球坐标系 转到瞬时平天球 坐标系 -step 5: 瞬时平天球坐标系转换为协议天球坐标系(J2000) -**/ - -double BASECONSTVARIABLEAPI sind(double degree); - -double BASECONSTVARIABLEAPI cosd(double d); - -// 插值 -ErrorCode BASECONSTVARIABLEAPI polyfit(const double* x, const double* y, int xyLength, int poly_n, std::vector& out_factor, double& out_chisq); - -// 叉乘 -Point3 BASECONSTVARIABLEAPI crossProduct(const Point3& a, const Point3& b); - -Eigen::Matrix3d BASECONSTVARIABLEAPI rotationMatrix(const Eigen::Vector3d& axis, double angle); - -long double BASECONSTVARIABLEAPI convertToMilliseconds(const std::string& dateTimeStr); - -QDateTime BASECONSTVARIABLEAPI parseCustomDateTime(const QString& dateTimeStr); -/// -/// list 应该是按照从小到大的顺序排好 -/// -/// -/// -/// -long BASECONSTVARIABLEAPI FindValueInStdVector(std::vector& list,double& findv); - -long BASECONSTVARIABLEAPI InsertValueInStdVector(std::vector& list, double insertValue, bool repeatValueInsert = false); - -long BASECONSTVARIABLEAPI FindValueInStdVectorLast(std::vector& list, double& findv); - -ErrorCode BASECONSTVARIABLEAPI polynomial_fit(const std::vector& x, const std::vector& y, int degree, std::vector& out_factor, double& out_chisq); - -QVector BASECONSTVARIABLEAPI SatellitePos2SatelliteAntPos(QVector poses); - -QVector BASECONSTVARIABLEAPI SatelliteAntPos2SatellitePos(QVector poses); - -QString BASECONSTVARIABLEAPI getDebugDataPath(QString filename); -std::vector BASECONSTVARIABLEAPI split(const std::string& str, char delimiter); -Eigen::VectorXd BASECONSTVARIABLEAPI linspace(double start, double stop, int num); - - -/** 内存赋值 ***********************************************************************************************************/ -void initializeMatrixWithSSE2(Eigen::MatrixXd& mat, const double* data, long rowcount, long colcount); -void initializeMatrixWithSSE2(Eigen::MatrixXf& mat, const float* data, long rowcount, long colcount); - -Eigen::MatrixXd BASECONSTVARIABLEAPI MuhlemanSigmaArray(Eigen::MatrixXd& eta_deg); -Eigen::MatrixXd BASECONSTVARIABLEAPI dB2Amp(Eigen::MatrixXd& sigma0); - - -struct TimestampMicroseconds { - boost::int64_t msecsSinceEpoch; // 自1970-01-01T00:00:00 UTC以来的毫秒数 - int microseconds; // 额外的微秒(精确到微秒) -}; - - -bool BASECONSTVARIABLEAPI isLeapYear(int year); -int BASECONSTVARIABLEAPI daysInMonth(int year, int month); - -TimestampMicroseconds BASECONSTVARIABLEAPI parseAndConvert( std::string dateTimeStr); - - -/** 模板函数类 ***********************************************************************************************************/ - -inline double calculate_MuhlemanSigma(double eta_deg) { - const double eta_rad = eta_deg * M_PI / 180.0; // 角度转弧度 - - const double cos_eta = std::cos(eta_rad); - const double sin_eta = std::sin(eta_rad); - - const double denominator = sin_eta + 0.1 * cos_eta; - - return (0.0133 * cos_eta) / std::pow(denominator, 3); -}; - - - -template -inline void memsetInitArray(std::shared_ptr ptr, long arrcount, T ti) { - for (long i = 0; i < arrcount; i++) { - ptr.get()[i] = ti; - } -}; - -template -inline void memcpyArray(std::shared_ptr srct, std::shared_ptr dest, long arrcount) { - for (long i = 0; i < arrcount; i++) { - dest.get()[i] = srct.get()[i]; - } -}; - - -template -inline void minValueInArr(T* ptr, long arrcount, T& minvalue) { - - if (arrcount == 0)return; - - minvalue = ptr[0]; - for (long i = 0; i < arrcount; i++) { - if (minvalue > ptr[i]) { - minvalue = ptr[i]; - } - } -}; - -template -inline void maxValueInArr(T* ptr, long arrcount, T& maxvalue) { - - if (arrcount == 0)return; - - maxvalue = ptr[0]; - for (long i = 0; i < arrcount; i++) { - if (maxvalue < ptr[i]) { - maxvalue = ptr[i]; - } - } -}; - - - -/** 常用SAR工具 ***********************************************************************************************************/ - - -template -inline T complexAbs(std::complex ccdata) { - return T(sqrt(pow(ccdata.real(), 2) + pow(ccdata.imag(), 2))); -}; - -template -inline void complex2dB(std::complex* ccdata, T* outdata, long long count) { - - for (long long i = 0; i < count; i++) { - outdata[i] = 20 * log10(complexAbs(ccdata[i])); - } - -}; - - - -#endif \ No newline at end of file diff --git a/BaseCommonLibrary/BaseTool/EchoDataFormat.cpp b/BaseCommonLibrary/BaseTool/EchoDataFormat.cpp deleted file mode 100644 index bc50ed5..0000000 --- a/BaseCommonLibrary/BaseTool/EchoDataFormat.cpp +++ /dev/null @@ -1,822 +0,0 @@ -#include "stdafx.h" -#include "EchoDataFormat.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "ImageOperatorBase.h" - - -std::shared_ptr CreatePluseAntPosArr(long pluseCount) -{ - return std::shared_ptr(new PluseAntPos[pluseCount],delArrPtr); -} - -long getPluseDataSize(PluseData& pluseData) -{ - long datasize = sizeof(long) + sizeof(double) + sizeof(double) * 6 + sizeof(long);// PRFId,time,px-vz,pluseCount - datasize = datasize + pluseData.plusePoints * sizeof(double) * 2; // ݿ - return datasize; -} - -ErrorCode getPluseDataFromBuffer(char* buffer, PluseData & data) -{ - long seekid = 0; - std::memcpy(&data.id, buffer + seekid, sizeof(data.id)); seekid += sizeof(data.id); - std::memcpy(&data.time, buffer + seekid, sizeof(data.time)); seekid += sizeof(data.time); - std::memcpy(&data.Px, buffer + seekid, sizeof(data.Px)); seekid += sizeof(data.Px); - std::memcpy(&data.Py, buffer + seekid, sizeof(data.Py)); seekid += sizeof(data.Py); - std::memcpy(&data.Pz, buffer + seekid, sizeof(data.Pz)); seekid += sizeof(data.Pz); - std::memcpy(&data.Vx, buffer + seekid, sizeof(data.Vx)); seekid += sizeof(data.Vx); - std::memcpy(&data.Vy, buffer + seekid, sizeof(data.Vy)); seekid += sizeof(data.Vy); - std::memcpy(&data.Vz, buffer + seekid, sizeof(data.Vz)); seekid += sizeof(data.Vz); - std::memcpy(&data.plusePoints, buffer + seekid, sizeof(data.plusePoints)); seekid += sizeof(data.plusePoints); - - Eigen::MatrixXd echoData_real = Eigen::MatrixXd::Zero(1, data.plusePoints); - Eigen::MatrixXd echoData_imag = Eigen::MatrixXd::Zero(1, data.plusePoints); - std::memcpy(echoData_real.data(), buffer + seekid, sizeof(data.plusePoints)); seekid += data.plusePoints * sizeof(double); - std::memcpy(echoData_imag.data(), buffer + seekid, sizeof(data.plusePoints)); - - std::shared_ptr echoData = std::make_shared(1, data.plusePoints); - echoData->real() = echoData_real.array(); - echoData->imag() = echoData_imag.array(); - return ErrorCode::SUCCESS; -} - -std::shared_ptr CreatePluseDataArr(long pluseCount) -{ - return std::shared_ptr(new PluseData[pluseCount],delArrPtr); -} - -std::shared_ptr> CreateEchoData(long plusePoints) -{ - return std::shared_ptr>(new std::complex[plusePoints],delArrPtr); -} - -EchoL0Dataset::EchoL0Dataset() -{ - this->folder=""; - this->filename=""; - this->xmlname=""; - this->GPSPointFilename=""; - this->echoDataFilename=""; - this->xmlFilePath=""; - this->GPSPointFilePath=""; - this->echoDataFilePath=""; - this->simulationTaskName = ""; - - this->PluseCount = 0; - this->PlusePoints = 0; - this->NearRange = 0; - this->FarRange = 0; - this->centerFreq = 0; - this->Fs = 0; - - this->folder.clear(); - this->filename.clear(); - this->xmlname.clear(); - this->GPSPointFilename.clear(); - this->echoDataFilename.clear(); - this->xmlFilePath.clear(); - this->GPSPointFilePath.clear(); - this->echoDataFilePath.clear(); - this->simulationTaskName.clear(); - -} - -EchoL0Dataset::~EchoL0Dataset() -{ -} - -ErrorCode EchoL0Dataset::OpenOrNew(QString folder, QString filename, long PluseCount, long PlusePoints) -{ - qDebug() << "--------------Echo Data OpenOrNew ---------------------------------------"; - qDebug() << "Folder: " << folder; - qDebug() << "Filename: " << filename; - QDir dir(folder); - if (dir.exists() == false) - { - dir.mkpath(folder); - } - else {} - - if (dir.exists() == false) { - return ErrorCode::FOLDER_NOT_EXIST; - } - else {} - QString filePath = dir.filePath(filename); // ļ· - - this->folder = folder; - this->filename = filename; - this->simulationTaskName = filename; - - this->xmlname=filename+".xml"; - this->GPSPointFilename=filename+".gpspos.data"; - this->echoDataFilename = filename + ".L0echo.data"; - - this->xmlFilePath = dir.filePath(this->xmlname); - this->GPSPointFilePath = dir.filePath(this->GPSPointFilename); - this->echoDataFilePath = dir.filePath(this->echoDataFilename); - - this->PluseCount = PluseCount; - this->PlusePoints = PlusePoints; - - - // - if (QFile(this->xmlFilePath).exists()) - { - this->loadFromXml(); - } - else - { - this->saveToXml(); - } - - if (QFile(this->GPSPointFilePath).exists() == false) { - // ļ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - GDALDataset* poDstDS=(poDriver->Create(this->GPSPointFilePath.toUtf8().constData(), 19, PluseCount, 1, GDT_Float64, NULL)); - GDALFlushCache((GDALDatasetH)poDstDS); - GDALClose(poDstDS); - //poDstDS.reset(); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - - } - - if (QFile(this->echoDataFilePath).exists() == false) { - - // ļ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - GDALDataset* poDstDS = (poDriver->Create(this->echoDataFilePath.toUtf8().constData(), PlusePoints, PluseCount, 1, GDT_CFloat64, NULL)); - GDALFlushCache((GDALDatasetH)poDstDS); - GDALClose(poDstDS); - //poDstDS.reset(); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - - } - - - - return ErrorCode::SUCCESS; -} - -ErrorCode EchoL0Dataset::Open(QString xmlfilepath) -{ - QFileInfo fileInfo(xmlfilepath); - QString fileName = fileInfo.fileName(); // ȡļ - QString fileSuffix = fileInfo.suffix(); // ȡ׺ - QString fileNameWithoutSuffix = fileInfo.baseName(); // ȡ׺ļ - QString directoryPath = fileInfo.path(); // ȡļ· - if (fileSuffix.toLower() == "xml" || fileSuffix.toLower() == ".xml") { - return this->Open(directoryPath,fileNameWithoutSuffix); - } - else { - return ErrorCode::ECHO_L0DATA_XMLNAMEERROR; - } - - return ErrorCode::SUCCESS; -} - -ErrorCode EchoL0Dataset::Open(QString folder, QString filename) -{ - QDir dir(folder); - if (dir.exists() == false) - { - return ErrorCode::FOLDER_NOT_EXIST; - } - else {} - - if (dir.exists() == false) { - return ErrorCode::FOLDER_NOT_EXIST; - } - else {} - QString filePath = dir.filePath(filename); // ļ· - - this->folder = folder; - this->filename = filename; - this->simulationTaskName = filename; - - this->xmlname = filename + ".xml"; - this->GPSPointFilename = filename + ".gpspos.data"; - this->echoDataFilename = filename + ".L0echo.data"; - - this->xmlFilePath = dir.filePath(this->xmlname); - this->GPSPointFilePath = dir.filePath(this->GPSPointFilename); - this->echoDataFilePath = dir.filePath(this->echoDataFilename); - - this->PluseCount = PluseCount; - this->PlusePoints = PlusePoints; - - // - if (QFile(this->xmlFilePath).exists()) - { - this->loadFromXml(); - } - else - { - return ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR; - } - return ErrorCode::SUCCESS; -} - -QString EchoL0Dataset::getxmlName() -{ - return xmlname; -} - -QString EchoL0Dataset::getGPSPointFilename() -{ - return GPSPointFilename; -} - -QString EchoL0Dataset::getEchoDataFilename() -{ - return GPSPointFilePath; -} - -QString EchoL0Dataset::getGPSPointFilePath() -{ - return this->GPSPointFilePath; -} - -QString EchoL0Dataset::getEchoDataFilePath() -{ - return this->echoDataFilePath; -} - -void EchoL0Dataset::initEchoArr(std::complex init0) -{ - long blockline = Memory1MB / 8 / 2 / this->PlusePoints * 8000; - - long start = 0; - for (start = 0; start < this->PluseCount; start = start + blockline) { - long templine = start + blockline < this->PluseCount ? blockline : this->PluseCount - start; - std::shared_ptr> echotemp = this->getEchoArr(start, templine); - for (long i = 0; i < templine; i++) { - for (long j = 0; j < this->PlusePoints; j++) { - echotemp.get()[i * this->PlusePoints + j] = init0; - } - } - this->saveEchoArr(echotemp, start, templine); - qDebug() << "echo init col : " << start << "\t-\t" << start + templine << "\t/\t" << this->PluseCount; - } -} - -// Getter Setter ʵ -long EchoL0Dataset::getPluseCount() { return this->PluseCount; } -void EchoL0Dataset::setPluseCount(long pulseCount) { this->PluseCount = pulseCount; } - -long EchoL0Dataset::getPlusePoints() { return this->PlusePoints; } -void EchoL0Dataset::setPlusePoints(long pulsePoints) { this->PlusePoints = pulsePoints; } - - -double EchoL0Dataset::getNearRange() { return this->NearRange; } -void EchoL0Dataset::setNearRange(double nearRange) { this->NearRange = nearRange; } - -double EchoL0Dataset::getFarRange() { return this->FarRange; } -void EchoL0Dataset::setFarRange(double farRange) { this->FarRange = farRange; } - -double EchoL0Dataset::getCenterFreq() { return this->centerFreq; } -void EchoL0Dataset::setCenterFreq(double freq) { this->centerFreq = freq; } - -double EchoL0Dataset::getFs() { return this->Fs; } -void EchoL0Dataset::setFs(double samplingFreq) { this->Fs = samplingFreq; } - -QString EchoL0Dataset::getSimulationTaskName() { return this->simulationTaskName; } -void EchoL0Dataset::setSimulationTaskName(const QString& taskName) { this->simulationTaskName = taskName; } - -double EchoL0Dataset::getCenterAngle() -{ - return this->CenterAngle; -} - -void EchoL0Dataset::setCenterAngle(double angle) -{ - this->CenterAngle = angle; -} - -QString EchoL0Dataset::getLookSide() -{ - return this->LookSide; -} - -void EchoL0Dataset::setLookSide(QString lookside) -{ - this->LookSide = lookside; -} - -double EchoL0Dataset::getBandwidth() -{ - return this->bandwidth; -} - -void EchoL0Dataset::setBandwidth(double Inbandwidth) -{ - this->bandwidth = Inbandwidth; -} - -SatelliteAntPos EchoL0Dataset::getSatelliteAntPos(long prf_id) -{ - std::shared_ptr antpos = this->getAntPos(); - SatelliteAntPos prfpos{}; - prfpos.time = antpos.get()[prf_id *19 + 0]; - prfpos.Px = antpos.get()[prf_id *19 + 1]; - prfpos.Py = antpos.get()[prf_id *19 + 2]; - prfpos.Pz = antpos.get()[prf_id *19 + 3]; - prfpos.Vx = antpos.get()[prf_id *19 + 4]; - prfpos.Vy = antpos.get()[prf_id *19 + 5]; - prfpos.Vz = antpos.get()[prf_id *19 + 6]; - prfpos.AntDirectX = antpos.get()[prf_id *19 + 7]; - prfpos.AntDirectY = antpos.get()[prf_id *19 + 8]; - prfpos.AntDirectZ = antpos.get()[prf_id *19 + 9]; - prfpos.AVx = antpos.get()[prf_id *19 + 10]; - prfpos.AVy = antpos.get()[prf_id *19 + 11]; - prfpos.AVz =antpos.get()[prf_id *19 + 12]; - prfpos.ZeroAntDiectX = antpos.get()[prf_id *19 + 13]; - prfpos.ZeroAntDiectY = antpos.get()[prf_id *19 + 14]; - prfpos.ZeroAntDiectZ = antpos.get()[prf_id *19 + 15]; - prfpos.lon =antpos.get()[prf_id *19 + 16]; - prfpos.lat =antpos.get()[prf_id *19 + 17]; - prfpos.ati =antpos.get()[prf_id *19 + 18]; - return prfpos; -} - -void EchoL0Dataset::setRefPhaseRange(double refRange) -{ - this->refPhaseRange = refRange; -} - -double EchoL0Dataset::getRefPhaseRange() -{ - return this->refPhaseRange; -} - -// ӡϢʵ -void EchoL0Dataset::printInfo() { - qDebug() << "Simulation Task Name: " << this->simulationTaskName ; - qDebug() << "Pulse Count: " << this->PluseCount ; - qDebug() << "Pulse Points: " << this->PlusePoints; - qDebug() << "Near Range: " << this->NearRange ; - qDebug() << "Far Range: " << this->FarRange; - qDebug() << "Center Frequency: " << this->centerFreq ; - qDebug() << "Sampling Frequency: " << this->Fs ; - qDebug() << "Band width: " << this->bandwidth ; -} - -// xmlļд -void EchoL0Dataset::saveToXml() { - - QString filePath = this->xmlFilePath; - - QFile file(filePath); - if (!file.open(QIODevice::WriteOnly)) { - qWarning() << "Cannot open file for writing:" << filePath; - return; - } - - QXmlStreamWriter xmlWriter(&file); - xmlWriter.setAutoFormatting(true); - xmlWriter.writeStartDocument(); - xmlWriter.writeStartElement("SimulationConfig"); - - xmlWriter.writeTextElement("PluseCount", QString::number(this->PluseCount)); - xmlWriter.writeTextElement("BandWidth", QString::number(this->bandwidth)); - xmlWriter.writeTextElement("PlusePoints", QString::number(this->PlusePoints)); - xmlWriter.writeTextElement("NearRange", QString::number(this->NearRange)); - xmlWriter.writeTextElement("FarRange", QString::number(this->FarRange)); - xmlWriter.writeTextElement("CenterFreq", QString::number(this->centerFreq)); - xmlWriter.writeTextElement("Fs", QString::number(this->Fs)); - xmlWriter.writeTextElement("CenterAngle", QString::number(this->CenterAngle)); - xmlWriter.writeTextElement("LookSide", this->LookSide); - xmlWriter.writeTextElement("SimulationTaskName", this->simulationTaskName); - xmlWriter.writeTextElement("Filename", this->filename); - xmlWriter.writeTextElement("Xmlname", this->xmlname); - xmlWriter.writeTextElement("GPSPointFilename", this->GPSPointFilename); - xmlWriter.writeTextElement("EchoDataFilename", this->echoDataFilename); - xmlWriter.writeTextElement("refPhaseRange", QString::number(this->refPhaseRange)); - - xmlWriter.writeEndElement(); // SimulationConfig - xmlWriter.writeEndDocument(); - - file.close(); -} - -ErrorCode EchoL0Dataset::loadFromXml() { - QString filePath = this->xmlFilePath; - QFile file(filePath); - if (!file.open(QIODevice::ReadOnly)) { - qWarning() << "Cannot open file for reading:" << filePath; - return ErrorCode::FILEOPENFAIL; - } - - - bool PluseCountflag = false; - bool PlusePointsflag = false; - bool NearRangeflag = false; - bool FarRangeflag = false; - bool CenterFreqflag = false; - bool Fsflag = false; - - - QXmlStreamReader xmlReader(&file); - while (!xmlReader.atEnd() && !xmlReader.hasError()) { - xmlReader.readNext(); - - if (xmlReader.isStartElement()) { - QString elementName = xmlReader.name().toString(); - if (elementName == "BandWidth") { - this->bandwidth = xmlReader.readElementText().toDouble(); - } - else if (elementName == "PluseCount") { - this->PluseCount = xmlReader.readElementText().toLong(); - } - else if (elementName == "PlusePoints") { - this->PlusePoints = xmlReader.readElementText().toLong(); - PlusePointsflag = true; - } - else if (elementName == "NearRange") { - this->NearRange = xmlReader.readElementText().toDouble(); - NearRangeflag = true; - } - else if (elementName == "FarRange") { - this->FarRange = xmlReader.readElementText().toDouble(); - FarRangeflag = true; - } - else if (elementName == "CenterFreq") { - this->centerFreq = xmlReader.readElementText().toDouble(); - CenterFreqflag = true; - } - else if (elementName == "Fs") { - this->Fs = xmlReader.readElementText().toDouble(); - Fsflag = true; - } - else if (elementName == "refPhaseRange") { - this->refPhaseRange = xmlReader.readElementText().toDouble(); - Fsflag = true; - } - else if (elementName == "SimulationTaskName") { - this->simulationTaskName = xmlReader.readElementText(); - } - else if (elementName == "Filename") { - this->filename = xmlReader.readElementText(); - } - else if (elementName == "Xmlname") { - this->xmlname = xmlReader.readElementText(); - } - else if (elementName == "GPSPointFilename") { - this->GPSPointFilename = xmlReader.readElementText(); - } - else if (elementName == "EchoDataFilename") { - this->echoDataFilename = xmlReader.readElementText(); - } - else if (elementName == "CenterAngle") { - this->CenterAngle = xmlReader.readElementText().toDouble(); - } - else if (elementName == "LookSide") { - this->LookSide = xmlReader.readElementText(); - } - } - } - - if (xmlReader.hasError()) { - qWarning() << "XML error:" << xmlReader.errorString(); - file.close(); - return ErrorCode::ECHO_L0DATA_XMLFILENOTOPEN; - } - - if (!(PlusePointsflag && PlusePointsflag && FarRangeflag && NearRangeflag && CenterFreqflag && Fsflag)) { - file.close(); - return ErrorCode::ECHO_L0DATA_XMLFILENOTOPEN; - } - - file.close(); - - return ErrorCode::SUCCESS; -} - -std::shared_ptr EchoL0Dataset::getAntPosVelc() -{ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - long prfcount = this->PluseCount; - std::shared_ptr antposlist= SatelliteAntPosOperator::readAntPosFile(this->GPSPointFilePath, prfcount); - - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - return antposlist; -} - -std::shared_ptr EchoL0Dataset::getAntPos() -{ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - // ȡļ - std::shared_ptr rasterDataset = OpenDataset(this->GPSPointFilePath, GDALAccess::GA_ReadOnly); - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* demBand = rasterDataset->GetRasterBand(1); - - long width = rasterDataset->GetRasterXSize(); - long height = rasterDataset->GetRasterYSize(); - long band_num = rasterDataset->GetRasterCount(); - - std::shared_ptr temp = nullptr; - - if (gdal_datatype == GDT_Float64) { - temp=std::shared_ptr(new double[this->PluseCount * 19],delArrPtr); - demBand->RasterIO(GF_Read, 0, 0, 19, this->PluseCount, temp.get(), 19, this->PluseCount, gdal_datatype, 0, 0); - } - else { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_GPSFILEFORMATERROR)) ; - } - rasterDataset.reset(); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - return temp; -} - -std::shared_ptr> EchoL0Dataset::getEchoArr(long startPRF, long& PRFLen) -{ - if (!(startPRF < this->PluseCount)) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_PRFIDXOUTRANGE))<PluseCount; - return nullptr; - } - else {} - - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - std::shared_ptr rasterDataset = OpenDataset(this->echoDataFilePath, GDALAccess::GA_ReadOnly); - - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* poBand = rasterDataset->GetRasterBand(1); - if (NULL==poBand||nullptr == poBand) { - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - return nullptr; - } - else {} - long width = rasterDataset->GetRasterXSize(); - long height = rasterDataset->GetRasterYSize(); - long band_num = rasterDataset->GetRasterCount(); - - PRFLen = (PRFLen + startPRF) < height ? PRFLen : height - startPRF; - - std::shared_ptr> temp = nullptr; - if (height != this->PluseCount || width != this->PlusePoints) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - } - else { - if (gdal_datatype == GDT_CFloat64) { - temp= std::shared_ptr>(new std::complex[PRFLen * width ], delArrPtr); - poBand->RasterIO(GF_Read, 0, startPRF, width, PRFLen, temp.get(), width, PRFLen, GDT_CFloat64, 0, 0); - GDALFlushCache((GDALDatasetH)rasterDataset.get()); - } - else { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - } - } - - rasterDataset.reset(); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - return temp; -} - - -std::vector> EchoL0Dataset::getEchoArrVector(long startPRF, long& PRFLen) { - if (!(startPRF < this->PluseCount)) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_PRFIDXOUTRANGE)) << startPRF << " " << this->PluseCount; - return std::vector>(0); - } - else {} - - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - std::shared_ptr rasterDataset = OpenDataset(this->echoDataFilePath, GDALAccess::GA_ReadOnly); - - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* poBand = rasterDataset->GetRasterBand(1); - if (NULL == poBand || nullptr == poBand) { - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - return std::vector>(0); - } - else {} - long width = rasterDataset->GetRasterXSize(); - long height = rasterDataset->GetRasterYSize(); - long band_num = rasterDataset->GetRasterCount(); - - PRFLen = (PRFLen + startPRF) < height ? PRFLen : height - startPRF; - - std::vector> tempArr(size_t(PRFLen) * width); - if (height != this->PluseCount || width != this->PlusePoints) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - } - else { - if (gdal_datatype == GDT_CFloat64) { - std::shared_ptr> temp(new std::complex[PRFLen * width], delArrPtr); - poBand->RasterIO(GF_Read, 0, startPRF, width, PRFLen, temp.get(), width, PRFLen, GDT_CFloat64, 0, 0); - GDALFlushCache((GDALDatasetH)rasterDataset.get()); - - - for (long i = 0; i < PRFLen; i++){ - for (long j = 0; j < width; j++){ - tempArr[i * width + j] = temp.get()[i * width + j]; - } - } - - } - else { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - } - } - - rasterDataset.reset(); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - return tempArr; -} - - -std::shared_ptr> EchoL0Dataset::getEchoArr() -{ - return this->getEchoArr(0,this->PluseCount); -} - -ErrorCode EchoL0Dataset::saveAntPos(std::shared_ptr ptr) -{ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - // ȡļ - std::shared_ptr rasterDataset = OpenDataset(this->GPSPointFilePath, GDALAccess::GA_Update); - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* demBand = rasterDataset->GetRasterBand(1); - - long width = rasterDataset->GetRasterXSize(); - long height = rasterDataset->GetRasterYSize(); - long band_num = rasterDataset->GetRasterCount(); - - if (gdal_datatype == GDT_Float64) { - demBand->RasterIO(GF_Write, 0, 0, 19, this->PluseCount, ptr.get(), 19, this->PluseCount, gdal_datatype, 0, 0); - } - else { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_GPSFILEFORMATERROR)); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - return ErrorCode::ECHO_L0DATA_GPSFILEFORMATERROR; - } - rasterDataset.reset(); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - return ErrorCode::SUCCESS; -} - -ErrorCode EchoL0Dataset::saveEchoArr(std::shared_ptr> echoPtr, long startPRF, long PRFLen) -{ - if (!(startPRF < this->PluseCount)) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_PRFIDXOUTRANGE)); - return ErrorCode::ECHO_L0DATA_PRFIDXOUTRANGE; - } - else {} - - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(this->echoDataFilePath.toUtf8().constData(), GDALAccess::GA_Update)); - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* poBand = rasterDataset->GetRasterBand(1); - if (NULL == poBand || nullptr == poBand) { - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - return ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR; - } - else {} - long width = rasterDataset->GetRasterXSize(); - long height = rasterDataset->GetRasterYSize(); - long band_num = rasterDataset->GetRasterCount(); - - if (height != this->PluseCount || width != this->PlusePoints) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - return ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR; - } - else { - if (gdal_datatype == GDT_CFloat64) { - poBand->RasterIO(GF_Write, 0, startPRF, width, PRFLen, echoPtr.get(), width, PRFLen, GDT_CFloat64, 0, 0); - GDALFlushCache((GDALDatasetH)rasterDataset); - } - else { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - } - } - GDALClose(rasterDataset); - rasterDataset = nullptr; - GDALDestroy(); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - - return ErrorCode::SUCCESS; -} - -std::shared_ptr SatelliteAntPosOperator::readAntPosFile(QString filepath, long& count) -{ - gdalImage antimg(filepath); - long rowcount = count; - long colcount = 19; - std::shared_ptr antlist = readDataArr(antimg, 0, 0, rowcount, colcount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); - std::shared_ptr antpos(new SatelliteAntPos[rowcount], delArrPtr); - for (long i = 0; i < rowcount; i++) { - antpos.get()[i].time = antlist.get()[i * 19 + 0]; - antpos.get()[i].Px = antlist.get()[i * 19 + 1]; - antpos.get()[i].Py = antlist.get()[i * 19 + 2]; - antpos.get()[i].Pz = antlist.get()[i * 19 + 3]; - antpos.get()[i].Vx = antlist.get()[i * 19 + 4]; - antpos.get()[i].Vy = antlist.get()[i * 19 + 5]; - antpos.get()[i].Vz = antlist.get()[i * 19 + 6]; //7 - antpos.get()[i].AntDirectX = antlist.get()[i * 19 + 7]; - antpos.get()[i].AntDirectY = antlist.get()[i * 19 + 8]; - antpos.get()[i].AntDirectZ = antlist.get()[i * 19 + 9]; - antpos.get()[i].AVx = antlist.get()[i * 19 + 10]; - antpos.get()[i].AVy = antlist.get()[i * 19 + 11]; - antpos.get()[i].AVz = antlist.get()[i * 19 + 12]; - antpos.get()[i].ZeroAntDiectX = antlist.get()[i * 19 + 13]; - antpos.get()[i].ZeroAntDiectY = antlist.get()[i * 19 + 14]; - antpos.get()[i].ZeroAntDiectZ = antlist.get()[i * 19 + 15]; - antpos.get()[i].lon = antlist.get()[i * 19 + 16]; - antpos.get()[i].lat = antlist.get()[i * 19 + 17]; - antpos.get()[i].ati = antlist.get()[i * 19 + 18]; // 19 - } - return antpos; -} - -void SatelliteAntPosOperator::writeAntPosFile(QString filepath, std::shared_ptr data, const long count) -{ - gdalImage antimg=CreategdalImageDouble(filepath,count,19,1,true,true); - long rowcount = count; - long colcount = 19; - std::shared_ptr antpos(new double[rowcount*19], delArrPtr); - for (long i = 0; i < colcount; i++) { - antpos.get()[i * 19 + 1] = data.get()[i].time; - antpos.get()[i * 19 + 2] = data.get()[i].Px; - antpos.get()[i * 19 + 3] = data.get()[i].Py; - antpos.get()[i * 19 + 4] = data.get()[i].Pz; - antpos.get()[i * 19 + 5] = data.get()[i].Vx; - antpos.get()[i * 19 + 6] = data.get()[i].Vy; - antpos.get()[i * 19 + 7] = data.get()[i].Vz; - antpos.get()[i * 19 + 8] = data.get()[i].AntDirectX; - antpos.get()[i * 19 + 9] = data.get()[i].AntDirectY; - antpos.get()[i * 19 + 10] = data.get()[i].AntDirectZ; - antpos.get()[i * 19 + 11] = data.get()[i].AVx; - antpos.get()[i * 19 + 12] = data.get()[i].AVy; - antpos.get()[i * 19 + 13] = data.get()[i].AVz; - antpos.get()[i * 19 + 14] = data.get()[i].ZeroAntDiectX; - antpos.get()[i * 19 + 15] = data.get()[i].ZeroAntDiectY; - antpos.get()[i * 19 + 16] = data.get()[i].ZeroAntDiectZ; - antpos.get()[i * 19 + 17] = data.get()[i].lon; - antpos.get()[i * 19 + 18] = data.get()[i].lat; - antpos.get()[i * 19 + 19] = data.get()[i].ati; - } - antimg.saveImage(antpos, 0,0,rowcount, colcount, 1); - - return ; - - - -} diff --git a/BaseCommonLibrary/BaseTool/EchoDataFormat.h b/BaseCommonLibrary/BaseTool/EchoDataFormat.h deleted file mode 100644 index ec2f685..0000000 --- a/BaseCommonLibrary/BaseTool/EchoDataFormat.h +++ /dev/null @@ -1,225 +0,0 @@ -#pragma once -/*****************************************************************//** - * \file EchoDataFormat.h - * \brief 洢еĸƷݸʽҪزݸʽݿ - * - * \author 30453 - * \date October 2024 - *********************************************************************/ - - -#include "BaseConstVariable.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "BaseTool.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // for CPLMalloc() - -//======================================================================== -// زʽ -// file type: -// PRFCOUNT -// PRFPOINT -// nearRange -// farRange -// PRF1,time,Px,Py,Pz,Vx,Vy,Vz -// PRF2,time,Px,Py,Pz,Vx,Vy,Vz -// ------------------ ļ -------------------------------------- -// PRF1,time,Px,Py,Pz,Vx,Vy,Vz,PRFPOINT,RealData,imagData -// PRF2,time,Px,Py,Pz,Vx,Vy,Vz,PRFPOINT,RealData,imagData -// -------------------------------------------------------------- -// עBp˳ֻǹעλãĬϰĽ˳֯ -//======================================================================== - -// õĻزļʽ - -/// -/// ز-- -/// -struct PluseData { - long id; // PRF id - double time;// ʱ - double Px; // - double Py; - double Pz; - double Vx; // ٶ - double Vy; - double Vz; - long plusePoints; // - std::shared_ptr> echoData; // ز -}; - -long BASECONSTVARIABLEAPI getPluseDataSize(PluseData& pluseData); -ErrorCode BASECONSTVARIABLEAPI getPluseDataFromBuffer(char* buffer, PluseData& data); -std::shared_ptr BASECONSTVARIABLEAPI CreatePluseDataArr(long pluseCount); -std::shared_ptr> BASECONSTVARIABLEAPI CreateEchoData(long plusePoints); - - - -/// -/// ̬ -/// -struct PluseAntPos { - long id; // PRF id - double time;// ʱ - double Px; // - double Py; - double Pz; - double Vx; // ٶ - double Vy; - double Vz; -}; -std::shared_ptr BASECONSTVARIABLEAPI CreatePluseAntPosArr(long pluseCount); - - -class BASECONSTVARIABLEAPI SatelliteAntPosOperator { -public: - static std::shared_ptr readAntPosFile(QString filepath,long& count); - static void writeAntPosFile(QString filepath, std::shared_ptr< SatelliteAntPos> data,const long count); - - -}; - - - - - - - - - - - - - - - - - - -// L0 -class BASECONSTVARIABLEAPI EchoL0Dataset { - -public: - EchoL0Dataset(); - ~EchoL0Dataset(); - - -public: - ErrorCode OpenOrNew(QString folder, QString filename,long PluseCount,long PlusePoints); - ErrorCode Open(QString xmlfilepath); - ErrorCode Open(QString folder, QString filename); - QString getxmlName(); - QString getGPSPointFilename(); - QString getEchoDataFilename(); - QString getGPSPointFilePath(); - QString getEchoDataFilePath(); - void initEchoArr(std::complex init0); - - -private: // Ʒ - QString folder; - QString filename; - QString xmlname; - QString GPSPointFilename; - QString echoDataFilename; - // - QString xmlFilePath; - QString GPSPointFilePath; - QString echoDataFilePath; - - - -public: // ļ - // Getter Setter - long getPluseCount() ; - void setPluseCount(long pulseCount); - - long getPlusePoints() ; - void setPlusePoints(long pulsePoints); - - double getNearRange() ; - void setNearRange(double nearRange); - - double getFarRange() ; - void setFarRange(double farRange); - - double getCenterFreq() ; - void setCenterFreq(double freq); - - double getFs() ; - void setFs(double samplingFreq); - - QString getSimulationTaskName() ; - void setSimulationTaskName(const QString& taskName); - - double getCenterAngle(); - void setCenterAngle(double angle); - - QString getLookSide(); - void setLookSide(QString lookside); - - double getBandwidth(); - void setBandwidth(double Inbandwidth); - - SatelliteAntPos getSatelliteAntPos(long plusePRFID); - - void setRefPhaseRange(double refRange); - double getRefPhaseRange(); - // ӡϢijԱ - void printInfo() ; - -private: // ز - long PluseCount; - long PlusePoints; - double NearRange; - double FarRange; - double centerFreq; // Ƶ - double Fs; // ЧƵ - QString simulationTaskName; - - double CenterAngle; - QString LookSide; - double refPhaseRange; - double bandwidth; - -public: // д XML ĺ - void saveToXml(); - ErrorCode loadFromXml(); - -public: - // ȡļ - std::shared_ptr< SatelliteAntPos> getAntPosVelc(); - std::shared_ptr getAntPos(); - std::shared_ptr> getEchoArr(long startPRF, long& PRFLen); - std::shared_ptr> getEchoArr(); - std::vector> getEchoArrVector(long startPRF, long& PRFLen); - //ļ - ErrorCode saveAntPos(std::shared_ptr ptr); // עΣգдǰǷȷ - ErrorCode saveEchoArr(std::shared_ptr> echoPtr, long startPRF, long PRFLen); - -}; - - - - diff --git a/BaseCommonLibrary/BaseTool/FileOperator.cpp b/BaseCommonLibrary/BaseTool/FileOperator.cpp deleted file mode 100644 index 6d6ba6c..0000000 --- a/BaseCommonLibrary/BaseTool/FileOperator.cpp +++ /dev/null @@ -1,261 +0,0 @@ -#include "stdafx.h" -#include "FileOperator.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - - -QString addMaskToFileName(const QString& filePath,QString _zzname) { - // 获取文件路径和文件名 - QFileInfo fileInfo(filePath); - - // 获取文件名和扩展名 - QString baseName = fileInfo.baseName(); // 不包含扩展名的文件名 - QString extension = fileInfo.suffix(); // 文件扩展名(例如 ".txt", ".jpg") - - // 拼接新的文件名 - QString newFileName = baseName + _zzname; // 在文件名中增加 "_mask" - if (!extension.isEmpty()) { - newFileName += "." + extension; // 如果有扩展名,添加扩展名 - } - - // 返回新的文件路径 - QString newFilePath = fileInfo.path() + "/" + newFileName; - return newFilePath; -} - - -std::vector getFilelist(const QString& folderpath, const QString& filenameExtension, int (*logfun)(QString logtext, int value)) -{ - QString filenameExtensionStr = filenameExtension; - filenameExtensionStr = filenameExtensionStr.remove(0, 1); - std::vector filenames(0); - if (isExists(folderpath) && isDirectory(folderpath)) { - QDir directory(folderpath); - if (directory.exists() && directory.isReadable()) { - QFileInfoList fileList = directory.entryInfoList(QDir::Files | QDir::NoDotAndDotDot); - for (const QFileInfo& fileInfo : fileList) { -// qDebug() << fileInfo.filePath() + "\nExtension: (" + filenameExtensionStr + ", " + fileInfo.suffix() + ")"; - if (filenameExtensionStr == u8"*" || filenameExtensionStr == fileInfo.suffix()) { - filenames.push_back(fileInfo.filePath()); - } - if (logfun) { - logfun(fileInfo.filePath() + "\nExtension: (" + filenameExtensionStr + ", " + fileInfo.suffix() + ")", 4); - } - } - } - else { - qWarning() << "Folder does not exist or is not readable: " << folderpath; - } - return filenames; - } - else { - return std::vector(0); - } - -} - -QString getParantFolderNameFromPath(const QString& path) -{ - QDir directory(path); - directory.cdUp(); - QString parentPath = directory.absolutePath(); - return directory.dirName(); -} - -QString getParantFromPath(const QString& path) -{ - //qDebug() << path; - QDir directory(path); - directory.cdUp(); - QString parentPath = directory.absolutePath(); - //qDebug() << parentPath; - return parentPath; -} - -QString getFileNameFromPath(const QString& path) -{ - QFileInfo fileInfo(path); - return fileInfo.fileName(); -} - -QString getFileNameWidthoutExtend(QString path) -{ - QFileInfo fileInfo(path); - QString fileNameWithoutExtension = fileInfo.completeBaseName(); // 获取无后缀文件名 - qDebug() << u8"File name without extension: " << fileNameWithoutExtension; - return fileNameWithoutExtension; -} - -QString BASECONSTVARIABLEAPI getFileExtension(QString path) -{ - QFileInfo fileInfo(path); - QString fileExtension = fileInfo.suffix(); // 获取无后缀文件名 - return fileExtension; -} - -bool isDirectory(const QString& path) -{ - QFileInfo fileinfo(path); - return fileinfo.isDir(); -} - -bool isExists(const QString& path) -{ - QFileInfo fileinfo(path); - return fileinfo.exists(); -} - -bool isFile(const QString& path) -{ - QFileInfo fileinfo(path); - return fileinfo.isFile(); -} - -int write_binfile(char* filepath, char* data, size_t data_len) -{ - FILE* pd = fopen(filepath, "w"); - if (NULL == pd) { - return 2; - } - //数据块首地址: "&a",元素大小: "sizeof(unsigned __int8)", 元素个数: "10", 文件指针:"pd" - fwrite(data, sizeof(char), data_len, pd); - fclose(pd); - return -1; -} - - char* read_textfile(char* text_path, int* length) -{ - char* data = NULL; - FILE* fp1 = fopen(text_path, "r"); - if (fp1 == NULL) { - return NULL; - } - else {} - // 读取文件 - fseek(fp1, 0, SEEK_END); - int data_length = ftell(fp1); - data = (char*)malloc((data_length + 1) * sizeof(char)); - rewind(fp1); - if (data_length == fread(data, sizeof(char), data_length, fp1)) { - data[data_length] = '\0'; // 文件尾 - } - else { - free(data); - fclose(fp1); - return NULL; - } - fclose(fp1); - *length = data_length + 1; - return data; -} - -bool exists_test(const QString& name) -{ - return isExists(name); -} - -size_t fsize(FILE* fp) -{ - size_t n; - fpos_t fpos; // 当前位置 - fgetpos(fp, &fpos); // 获取当前位置 - fseek(fp, 0, SEEK_END); - n = ftell(fp); - fsetpos(fp, &fpos); // 恢复之前的位置 - return n; -} - - -void removeFile(const QString& filePath) -{ - QFile file(filePath); - - if (file.exists()) { - if (file.remove()) { - qDebug() << "File removed successfully: " << filePath; - } - else { - qWarning() << "Failed to remove file: " << filePath; - } - } - else { - qDebug() << "File does not exist: " << filePath; - } -} - -unsigned long convertToULong(const QString& input) { - bool ok; // Used to check if the conversion was successful - unsigned long result = input.toULong(&ok); - - if (!ok) { - qWarning() << "Conversion to unsigned long failed for input: " << input; - } - - return result; -} - -void copyFile(const QString& sourcePath, const QString& destinationPath) { - QFile sourceFile(sourcePath); - QFile destinationFile(destinationPath); - qDebug() << QString("copy file ready !! from ") + sourcePath+" to "+destinationPath ; - if (sourceFile.exists()) { - if (sourceFile.copy(destinationPath)) { - qDebug() << QString("copy file sucessfully !! from ") + sourcePath+" to "+destinationPath ; - // 复制成功 - //QMessageBox::information(nullptr, u8"成功", u8"文件复制成功"); - } - else { - // 复制失败 - if(sourceFile.exists()){ - QMessageBox::critical(nullptr, QObject::tr("error"), QObject::tr("The file already exists !!")); - } - else{ - QMessageBox::critical(nullptr, QObject::tr("error"), QObject::tr("file copy error")); - } - } - } - else { - // 源文件不存在 - QMessageBox::warning(nullptr, QObject::tr("warning"), QObject::tr("Source file not found")); - } -} - - - - -bool copyAndReplaceFile(const QString& sourceFilePath, const QString& destinationFilePath) { - // 检查源文件是否存在 - if (!QFile::exists(sourceFilePath)) { - qDebug() << "Source file does not exist:" << sourceFilePath; - return false; - } - - // 如果目标文件存在,则删除它 - if (QFile::exists(destinationFilePath)) { - if (!QFile::remove(destinationFilePath)) { - qDebug() << "Failed to remove existing destination file:" << destinationFilePath; - return false; - } - } - - // 复制文件 - if (!QFile::copy(sourceFilePath, destinationFilePath)) { - qDebug() << "Failed to copy file from" << sourceFilePath << "to" << destinationFilePath; - return false; - } - - qDebug() << "File copied successfully from" << sourceFilePath << "to" << destinationFilePath; - return true; -} diff --git a/BaseCommonLibrary/BaseTool/FileOperator.h b/BaseCommonLibrary/BaseTool/FileOperator.h deleted file mode 100644 index b016ede..0000000 --- a/BaseCommonLibrary/BaseTool/FileOperator.h +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once - -#ifndef FILEOPERATOR_H -#define FILEOPERATOR_H -#include "BaseConstVariable.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -bool BASECONSTVARIABLEAPI isDirectory(const QString& path); -bool BASECONSTVARIABLEAPI isExists(const QString& path); -bool BASECONSTVARIABLEAPI isFile(const QString& path); -void BASECONSTVARIABLEAPI removeFile(const QString& filePath); -unsigned long BASECONSTVARIABLEAPI convertToULong(const QString& input); -/// -/// 获取文件(绝对路径) -/// -/// -/// -/// -std::vector BASECONSTVARIABLEAPI getFilelist(const QString& folderpath, const QString& FilenameExtension = ".*", int (*logfun)(QString logtext, int value) = nullptr); - -QString BASECONSTVARIABLEAPI getParantFolderNameFromPath(const QString& path); - -QString BASECONSTVARIABLEAPI getFileNameFromPath(const QString& path); - -QString BASECONSTVARIABLEAPI getFileNameWidthoutExtend(QString path); - -QString BASECONSTVARIABLEAPI getFileExtension(QString path); - -int BASECONSTVARIABLEAPI write_binfile(char* filepath, char* data, size_t data_len); - -char* read_textfile(char* text_path, int* length); - -bool BASECONSTVARIABLEAPI exists_test(const QString& name); - -size_t BASECONSTVARIABLEAPI fsize(FILE* fp); - -QString BASECONSTVARIABLEAPI getParantFromPath(const QString& path); -void BASECONSTVARIABLEAPI copyFile(const QString& sourcePath, const QString& destinationPath); -QString BASECONSTVARIABLEAPI addMaskToFileName(const QString& filePath, QString _zzname); -// QT FileOperator - -bool BASECONSTVARIABLEAPI copyAndReplaceFile(const QString& sourceFilePath, const QString& destinationFilePath); - - -#endif \ No newline at end of file diff --git a/BaseCommonLibrary/BaseTool/GeoOperator.cpp b/BaseCommonLibrary/BaseTool/GeoOperator.cpp deleted file mode 100644 index ce49a3e..0000000 --- a/BaseCommonLibrary/BaseTool/GeoOperator.cpp +++ /dev/null @@ -1,500 +0,0 @@ -#include "stdafx.h" -#include "GeoOperator.h" -#include -#include -#include -#include -////#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include //#include "ogrsf_frmts.h" -#include -#include -#include "GeoOperator.h" -#include // OGRSpatialReference ڿռοת -#include // GDALWarp -#include - - -Landpoint operator +(const Landpoint& p1, const Landpoint& p2) -{ - return Landpoint{ p1.lon + p2.lon,p1.lat + p2.lat,p1.ati + p2.ati }; -} - -Landpoint operator -(const Landpoint& p1, const Landpoint& p2) -{ - return Landpoint{ p1.lon - p2.lon,p1.lat - p2.lat,p1.ati - p2.ati }; -} - -bool operator ==(const Landpoint& p1, const Landpoint& p2) -{ - return p1.lat == p2.lat && p1.lon == p2.lon && p1.ati == p2.ati; -} - - - -Landpoint operator *(const Landpoint& p, double scale) -{ - return Landpoint{ - p.lon * scale, - p.lat * scale, - p.ati * scale - }; -} - - -Landpoint LLA2XYZ(const Landpoint& LLA) { - double L = LLA.lon * d2r; - double B = LLA.lat * d2r; - double H = LLA.ati; - - double sinB = sin(B); - double cosB = cos(B); - - //double N = a / sqrt(1 - e * e * sin(B) * sin(B)); - double N = a / sqrt(1 - eSquare * sinB * sinB); - Landpoint result = { 0,0,0 }; - result.lon = (N + H) * cosB * cos(L); - result.lat = (N + H) * cosB * sin(L); - //result.z = (N * (1 - e * e) + H) * sin(B); - result.ati = (N * (1 - 1 / f_inverse) * (1 - 1 / f_inverse) + H) * sinB; - return result; -} - -void LLA2XYZ(const Landpoint& LLA, Point3& XYZ) -{ - double L = LLA.lon * d2r; - double B = LLA.lat * d2r; - double H = LLA.ati; - - double sinB = sin(B); - double cosB = cos(B); - - //double N = a / sqrt(1 - e * e * sin(B) * sin(B)); - double N = a / sqrt(1 - eSquare * sinB * sinB); - Landpoint result = { 0,0,0 }; - XYZ.x = (N + H) * cosB * cos(L); - XYZ.y = (N + H) * cosB * sin(L); - //result.z = (N * (1 - e * e) + H) * sin(B); - XYZ.z = (N * (1 - 1 / f_inverse) * (1 - 1 / f_inverse) + H) * sinB; - -} - - -Eigen::MatrixXd LLA2XYZ(Eigen::MatrixXd landpoint) -{ - landpoint.col(0) = landpoint.col(0).array() * d2r; // lon - landpoint.col(1) = landpoint.col(1).array() * d2r; // lat - - Eigen::MatrixXd sinB = (landpoint.col(1).array().sin());//lat - Eigen::MatrixXd cosB = (landpoint.col(1).array().cos());//lat - - Eigen::MatrixXd N = a / ((1 - sinB.array().pow(2) * eSquare).array().sqrt()); - Eigen::MatrixXd result(landpoint.rows(), 3); - - result.col(0) = (N.array() + landpoint.col(2).array()) * cosB.array() * Eigen::cos(landpoint.col(0).array()).array(); //x - result.col(1) = (N.array() + landpoint.col(2).array()) * cosB.array() * Eigen::sin(landpoint.col(0).array()).array(); //y - - result.col(2) = (N.array() * (1 - 1 / f_inverse) * (1 - 1 / f_inverse) + landpoint.col(2).array()) * sinB.array(); //z - - return result; -} - - -Landpoint XYZ2LLA(const Landpoint& XYZ) { - double tmpX = XYZ.lon;// - double temY = XYZ.lat;// - double temZ = XYZ.ati; - - double curB = 0; - double N = 0; - double sqrtTempXY = sqrt(tmpX * tmpX + temY * temY); - double calB = atan2(temZ, sqrtTempXY); - int counter = 0; - double sinCurB = 0; - while (abs(curB - calB) * r2d > epsilon && counter < 25) - { - curB = calB; - sinCurB = sin(curB); - N = a / sqrt(1 - eSquare * sinCurB * sinCurB); - calB = atan2(temZ + N * eSquare * sinCurB, sqrtTempXY); - counter++; - } - - Landpoint result = { 0,0,0 }; - result.lon = atan2(temY, tmpX) * r2d; - result.lat = curB * r2d; - result.ati = temZ / sinCurB - N * (1 - eSquare); - return result; -} - - - -void XYZ2BLH_FixedHeight(double x, double y, double z,double ati, Landpoint& point) { - const double a = 6378137.0; // WGS84 - const double f = 1.0 / 298.257223563; - const double e2 = 2 * f - f * f; // һƫƽ - - // 㾭L () - const double L_rad = std::atan2(y, x); - point.lon = L_rad * 180.0 / M_PI; // תΪ - - const double p = std::sqrt(x * x + y * y); - const double H = ati; // ʹ֪߶ - - // ʼγȹ㣨֪߶H - double B_rad = std::atan2(z, p * (1 - e2 * (a / (a + H)))); - - // γB̶H - for (int i = 0; i < 10; ++i) { // ֪Hʱ - const double sin_B = std::sin(B_rad); - const double N = a / std::sqrt(1 - e2 * sin_B * sin_B); - const double delta = e2 * N / (N + H); // ߶ȹ̶ʱ - - const double B_new = std::atan2(z, p * (1 - delta)); - - if (std::abs(B_new - B_rad) < 1e-9) { - B_rad = B_new; - break; - } - B_rad = B_new; - } - - point.lat = B_rad * 180.0 / M_PI; // ת - - // ȷΧ [-180, 180] - point.lon = std::fmod(point.lon + 360.0, 360.0); - if (point.lon > 180.0) point.lon -= 360.0; - point.ati = ati; -} - - -double getAngle(const Landpoint& a, const Landpoint& b) -{ - double c = dot(a, b) / (getlength(a) * getlength(b)); - if (a.lon * b.lat - a.lat * b.lon >= 0) { - return acos(c > 1 ? 1 : c < -1 ? -1 : c) * r2d; - } - else { - return 360 - acos(c > 1 ? 1 : c < -1 ? -1 : c) * r2d; - } -} - -double dot(const Landpoint& p1, const Landpoint& p2) -{ - return p1.lat * p2.lat + p1.lon * p2.lon + p1.ati * p2.ati; -} - -double getlength(const Landpoint& p1) { - - return sqrt(dot(p1, p1)); -} - -Landpoint crossProduct(const Landpoint& a, const Landpoint& b) { - return Landpoint{ - a.lat * b.ati - a.ati * b.lat,//x - a.ati * b.lon - a.lon * b.ati,//y - a.lon * b.lat - a.lat * b.lon//z - }; -} - -float cross2d(Point3 a, Point3 b) -{ - return a.x * b.y - a.y * b.x; -} - -Point3 operator -(Point3 a, Point3 b) -{ - return Point3{ a.x - b.x, a.y - b.y, a.z - b.z }; -} - -Point3 operator +(Point3 a, Point3 b) -{ - return Point3{ a.x + b.x, a.y + b.y, a.z + b.z }; -} - -double operator /(Point3 a, Point3 b) -{ - return sqrt(pow(a.x, 2) + pow(a.y, 2)) / sqrt(pow(b.x, 2) + pow(b.y, 2)); -} - - -Landpoint getSlopeVector(const Landpoint& p0, const Landpoint& p1, const Landpoint& p2, const Landpoint& p3, const Landpoint& p4,bool inLBH) { - Landpoint n0, n1, n2, n3, n4; - if (inLBH) { - n0 = LLA2XYZ(p0); - n1 = LLA2XYZ(p1); - n2 = LLA2XYZ(p2); - n3 = LLA2XYZ(p3); - n4 = LLA2XYZ(p4); - } - else { - n0 = p0; - n1 = p1; - n2 = p2; - n3 = p3; - n4 = p4; - } - - Landpoint n01 = n1 - n0, n02 = n2 - n0, n03 = n3 - n0, n04 = n4 - n0; - // ��n01Ϊ�������� - Landpoint np01 = p1 - p0, np02 = p2 - p0, np03 = p3 - p0, np04 = p4 - p0; - double a2 = getAngle(Landpoint{ np01.lon,np01.lat,0 }, Landpoint{ np02.lon,np02.lat,0 });// 01->02 - double a3 = getAngle(Landpoint{ np01.lon,np01.lat,0 }, Landpoint{ np03.lon,np03.lat,0 });// 01->03 - double a4 = getAngle(Landpoint{ np01.lon,np01.lat,0 }, Landpoint{ np04.lon,np04.lat,0 });// 01->04 - //qDebug() << a2 << "\t" << a3 << "\t" << a4 << endl; - a2 = 360 - a2; - a3 = 360 - a3; - a4 = 360 - a4; - Landpoint N, W, S, E; - N = n01; - if (a2 >= a3 && a2 >= a4) { - W = n02; - if (a3 >= a4) { - S = n03; - E = n04; - } - else { - S = n04; - E = n03; - } - } - else if (a3 >= a2 && a3 >= a4) { - W = n03; - if (a2 >= a4) { - S = n02; - E = n04; - } - else { - S = n04; - E = n02; - } - } - else if (a4 >= a2 && a4 >= a3) - { - W = n04; - if (a2 >= a3) { - S = n02; - E = n03; - } - else { - S = n03; - E = n02; - } - } - return (crossProduct(N, W) + crossProduct(W, S) + crossProduct(S, E) + crossProduct(E, N)) * 0.25; -} - - - -double distance(const Vector3D& p1, const Vector3D& p2) -{ - double dx = p1.x - p2.x; - double dy = p1.y - p2.y; - double dz = p1.z - p2.z; - return std::sqrt(dx * dx + dy * dy + dz * dz); -} - -double pointToLineDistance(const Vector3D& point, const Vector3D& linePoint, const Vector3D& lineDirection) -{ - Vector3D pointToLine = { point.x - linePoint.x, point.y - linePoint.y, point.z - linePoint.z }; - - // 计算点到直线的投影点的位? - double t = (pointToLine.x * lineDirection.x + pointToLine.y * lineDirection.y + pointToLine.z * lineDirection.z) / - (lineDirection.x * lineDirection.x + lineDirection.y * lineDirection.y + lineDirection.z * lineDirection.z); - - // 计算投影? - Vector3D projection = { linePoint.x + t * lineDirection.x, linePoint.y + t * lineDirection.y, linePoint.z + t * lineDirection.z }; - - // 计算点到直线的距? - return distance(point, projection); -} - -Vector3D operator+(const Vector3D& p1, const Vector3D& p2) -{ - return Vector3D{ p1.x + p2.x,p1.y + p2.y,p1.z + p2.z }; -} - -Vector3D operator-(const Vector3D& p1, const Vector3D& p2) -{ - return Vector3D{ p1.x - p2.x,p1.y - p2.y,p1.z - p2.z }; -} - -bool operator==(const Vector3D& p1, const Vector3D& p2) -{ - return p1.x == p2.x && p1.y == p2.y && p1.z == p2.z; -} - -Vector3D operator*(const Vector3D& p, double scale) -{ - return Vector3D{ - p.x * scale, - p.y * scale, - p.z * scale - }; -} - -Vector3D operator*(double scale, const Vector3D& p) -{ - return Vector3D{ - p.x * scale, - p.y * scale, - p.z * scale - }; -} - -double getAngle(const Vector3D& a, const Vector3D& b) -{ - double c = dot(a, b) / (getlength(a) * getlength(b)); - if (a.x * b.y - a.y * b.x >= 0) { - return acos(c > 1 ? 1 : c < -1 ? -1 : c) * r2d; - } - else { - return 360 - acos(c > 1 ? 1 : c < -1 ? -1 : c) * r2d; - } -} - -double getCosAngle(const Vector3D& a, const Vector3D& b) -{ - double c = dot(a, b) / (getlength(a) * getlength(b)); - return acos(c > 1 ? 1 : c < -1 ? -1 : c) * r2d; -} - -double dot(const Vector3D& p1, const Vector3D& p2) -{ - return p1.y * p2.y + p1.x * p2.x + p1.z * p2.z; -} - -double getlength(const Vector3D& p1) -{ - return std::sqrt(std::pow(p1.x, 2) + std::pow(p1.y, 2) + std::pow(p1.z, 2)); -} - -Vector3D crossProduct(const Vector3D& a, const Vector3D& b) -{ - return Vector3D{ - a.y * b.z - a.z * b.y,//x - a.z * b.x - a.x * b.z,//y - a.x * b.y - a.y * b.x//z - }; -} - - -/// -/// n1 -/// n4 n0 n2 -/// n3 -/// -Vector3D getSlopeVector(const Vector3D& n0, const Vector3D& n1, const Vector3D& n2, const Vector3D& n3, const Vector3D& n4) -{ - Vector3D n01 = n1 - n0, n02 = n2 - n0, n03 = n3 - n0, n04 = n4 - n0; - return (crossProduct(n01, n04) + crossProduct(n04, n03) + crossProduct(n03, n02) + crossProduct(n02, n01)) * 0.25; -} - - -SphericalCoordinates cartesianToSpherical(const CartesianCoordinates& cartesian) -{ - SphericalCoordinates spherical; - - spherical.r = std::sqrt(cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z); - spherical.theta = std::acos(cartesian.z / spherical.r); - spherical.phi = std::atan2(cartesian.y, cartesian.x); - - return spherical; -} - -CartesianCoordinates sphericalToCartesian(const SphericalCoordinates& spherical) -{ - CartesianCoordinates cartesian; - - cartesian.x = spherical.r * std::sin(spherical.theta) * std::cos(spherical.phi); - cartesian.y = spherical.r * std::sin(spherical.theta) * std::sin(spherical.phi); - cartesian.z = spherical.r * std::cos(spherical.theta); - - return cartesian; -} - - -double getlocalIncAngle(Landpoint& satepoint, Landpoint& landpoint, Landpoint& slopeVector) { - Landpoint Rsc = satepoint - landpoint; // AB=B-A - //double R = getlength(Rsc); - //qDebug() << R << endl; - double angle = getAngle(Rsc, slopeVector); - if (angle >= 180) { - return 360 - angle; - } - else { - return angle; - } -} - - -double getlocalIncAngle(Vector3D& satepoint, Vector3D& landpoint, Vector3D& slopeVector){ - Vector3D Rsc = satepoint - landpoint; // AB=B-A - //double R = getlength(Rsc); - //qDebug() << R << endl; - double angle = getAngle(Rsc, slopeVector); - if (angle >= 180) { - return 360 - angle; - } - else { - return angle; - } -} - -bool BASECONSTVARIABLEAPI ConvertResolutionToDegrees(int sourceEPSG, double resolutionMeters, double refLon, double refLat, double& degreePerPixelX, double& degreePerPixelY){ - // ʼԴϵƽͶӰĿϵWGS84 γȣ - OGRSpatialReference sourceSRS, targetSRS; - sourceSRS.importFromEPSG(sourceEPSG); // Դϵȷ EPSG - targetSRS.importFromEPSG(4326); // ĿΪ WGS84 γ - - // תγ -> ƽ - OGRCoordinateTransformation* toPlane = OGRCreateCoordinateTransformation(&targetSRS, &sourceSRS); - if (!toPlane) return false; - - // ο㾭γתΪƽ - double x = refLon, y = refLat; - if (!toPlane->Transform(1, &x, &y)) { - OGRCoordinateTransformation::DestroyCT(toPlane); - return false; - } - - // תƽ -> γ - OGRCoordinateTransformation* toGeo = OGRCreateCoordinateTransformation(&sourceSRS, &targetSRS); - if (!toGeo) { - OGRCoordinateTransformation::DestroyCT(toPlane); - return false; - } - - // 㶫ֱʣȱ仯 - double eastX = x + resolutionMeters, eastY = y; - double eastLon = eastX, eastLat = eastY; - if (!toGeo->Transform(1, &eastLon, &eastLat)) { - OGRCoordinateTransformation::DestroyCT(toPlane); - OGRCoordinateTransformation::DestroyCT(toGeo); - return false; - } - degreePerPixelX = (eastLon - refLon) / resolutionMeters; // ȷÿ׶Ӧ - - // 㱱ֱʣγȱ仯 - double northX = x, northY = y + resolutionMeters; - double northLon = northX, northLat = northY; - if (!toGeo->Transform(1, &northLon, &northLat)) { - OGRCoordinateTransformation::DestroyCT(toPlane); - OGRCoordinateTransformation::DestroyCT(toGeo); - return false; - } - degreePerPixelY = (northLat - refLat) / resolutionMeters; // γȷÿ׶Ӧ - - // ͷԴ - OGRCoordinateTransformation::DestroyCT(toPlane); - OGRCoordinateTransformation::DestroyCT(toGeo); - return true; -} diff --git a/BaseCommonLibrary/BaseTool/GeoOperator.h b/BaseCommonLibrary/BaseTool/GeoOperator.h deleted file mode 100644 index 66ce525..0000000 --- a/BaseCommonLibrary/BaseTool/GeoOperator.h +++ /dev/null @@ -1,147 +0,0 @@ -#pragma once - - -#ifndef _GEOOPERATOR_H -#define _GEOOPERATOR_H - -#include "BaseConstVariable.h" -#include -#include -#include -#include -#include -#include -#include - - -/// -/// 将经纬度转换为地固参心坐标系 -/// -/// 经纬度点--degree -/// 投影坐标系点 -Landpoint BASECONSTVARIABLEAPI LLA2XYZ(const Landpoint& LLA); -void BASECONSTVARIABLEAPI LLA2XYZ(const Landpoint& LLA,Point3& XYZ); -Eigen::MatrixXd BASECONSTVARIABLEAPI LLA2XYZ(Eigen::MatrixXd landpoint); - -/// -/// 将地固参心坐标系转换为经纬度 -/// -/// 固参心坐标系 -/// 经纬度--degree -Landpoint BASECONSTVARIABLEAPI XYZ2LLA(const Landpoint& XYZ); - -void BASECONSTVARIABLEAPI XYZ2BLH_FixedHeight(double x, double y, double z, double ati, Landpoint& point); - -Landpoint BASECONSTVARIABLEAPI operator +(const Landpoint& p1, const Landpoint& p2); - -Landpoint BASECONSTVARIABLEAPI operator -(const Landpoint& p1, const Landpoint& p2); - -bool BASECONSTVARIABLEAPI operator ==(const Landpoint& p1, const Landpoint& p2); - -Landpoint BASECONSTVARIABLEAPI operator *(const Landpoint& p, double scale); - -double BASECONSTVARIABLEAPI getAngle(const Landpoint& a, const Landpoint& b); - -double BASECONSTVARIABLEAPI dot(const Landpoint& p1, const Landpoint& p2); - -double BASECONSTVARIABLEAPI getlength(const Landpoint& p1); - -Landpoint BASECONSTVARIABLEAPI crossProduct(const Landpoint& a, const Landpoint& b); - - -Landpoint BASECONSTVARIABLEAPI getSlopeVector(const Landpoint& p0, const Landpoint& p1, const Landpoint& p2, const Landpoint& p3, const Landpoint& p4, bool inLBH=true); - -double BASECONSTVARIABLEAPI getlocalIncAngle(Landpoint& satepoint, Landpoint& landpoint, Landpoint& slopeVector); - -float BASECONSTVARIABLEAPI cross2d(Point3 a, Point3 b); - -Point3 BASECONSTVARIABLEAPI operator -(Point3 a, Point3 b); - -Point3 BASECONSTVARIABLEAPI operator +(Point3 a, Point3 b); - -double BASECONSTVARIABLEAPI operator /(Point3 a, Point3 b); - - - -// 矢量计算 -struct Vector3D { - double x, y, z; -}; - -// 计算两点之间的距离 -double BASECONSTVARIABLEAPI distance(const Vector3D& p1, const Vector3D& p2); -// 计算点到直线的最短距离 -double BASECONSTVARIABLEAPI pointToLineDistance(const Vector3D& point, const Vector3D& linePoint, const Vector3D& lineDirection); - -Vector3D BASECONSTVARIABLEAPI operator +(const Vector3D& p1, const Vector3D& p2); - -Vector3D BASECONSTVARIABLEAPI operator -(const Vector3D& p1, const Vector3D& p2); - -bool BASECONSTVARIABLEAPI operator ==(const Vector3D& p1, const Vector3D& p2); - -Vector3D BASECONSTVARIABLEAPI operator *(const Vector3D& p, double scale); - -Vector3D BASECONSTVARIABLEAPI operator *(double scale,const Vector3D& p ); - -double BASECONSTVARIABLEAPI getAngle(const Vector3D& a, const Vector3D& b); - -double BASECONSTVARIABLEAPI getCosAngle(const Vector3D& a, const Vector3D& b); - -double BASECONSTVARIABLEAPI dot(const Vector3D& p1, const Vector3D& p2); - -double BASECONSTVARIABLEAPI getlength(const Vector3D& p1); - -Vector3D BASECONSTVARIABLEAPI crossProduct(const Vector3D& a, const Vector3D& b); - - - -/// -/// n1 -/// n4 n0 n2 -/// n3 -/// -/// -/// -/// -/// -/// -/// -Vector3D BASECONSTVARIABLEAPI getSlopeVector(const Vector3D& n0, const Vector3D& n1, const Vector3D& n2, const Vector3D& n3, const Vector3D& n4); - - -struct CartesianCoordinates { - double x, y, z; -}; - -struct SphericalCoordinates { - double r, theta, phi; -}; - -SphericalCoordinates BASECONSTVARIABLEAPI cartesianToSpherical(const CartesianCoordinates& cartesian); - -CartesianCoordinates BASECONSTVARIABLEAPI sphericalToCartesian(const SphericalCoordinates& spherical); - -double BASECONSTVARIABLEAPI getlocalIncAngle(Vector3D& satepoint, Vector3D& landpoint, Vector3D& slopeVector); - - - -/** - * @brief 将平面坐标分辨率(米)转换为经纬度分辨率(度) - * @param sourceEPSG 平面坐标系 EPSG 码(如 UTM Zone 50N 对应 32650) - * @param resolutionMeters 输入分辨率(单位:米) - * @param refLon 参考点经度(十进制度,用于计算局部转换系数) - * @param refLat 参考点纬度(十进制度,用于计算局部转换系数) - * @param[out] degreePerPixelX 经度方向分辨率(度/像素) - * @param[out] degreePerPixelY 纬度方向分辨率(度/像素) - * @return 是否转换成功 - */ -bool BASECONSTVARIABLEAPI ConvertResolutionToDegrees( - int sourceEPSG, - double resolutionMeters, - double refLon, - double refLat, - double& degreePerPixelX, - double& degreePerPixelY -); - -#endif \ No newline at end of file diff --git a/BaseCommonLibrary/BaseTool/ImageOperatorBase.cpp b/BaseCommonLibrary/BaseTool/ImageOperatorBase.cpp deleted file mode 100644 index 0edf2f0..0000000 --- a/BaseCommonLibrary/BaseTool/ImageOperatorBase.cpp +++ /dev/null @@ -1,1793 +0,0 @@ -#include "stdafx.h" -#include "ImageOperatorBase.h" -#include "BaseTool.h" -#include "GeoOperator.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "FileOperator.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include // OGRSpatialReference 用于空间参考转换 -#include // 用于 GDALWarp 操作 - - - -/** - * 输入数据是ENVI格式数据 - */ - -std::shared_ptr OpenDataset(const QString& in_path, GDALAccess rwmode) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDataset* dataset_ptr = (GDALDataset*)(GDALOpen(in_path.toUtf8().constData(), rwmode)); - std::shared_ptr rasterDataset(dataset_ptr, CloseDataset); - return rasterDataset; -} - -void CloseDataset(GDALDataset* ptr) -{ - GDALClose(ptr); - ptr = NULL; -} - -int TIFF2ENVI(QString in_tiff_path, QString out_envi_path) -{ - std::shared_ptr ds = OpenDataset(in_tiff_path); - const char* args[] = { "-of", "ENVI", NULL }; - GDALTranslateOptions* psOptions = GDALTranslateOptionsNew((char**)args, NULL); - GDALClose(GDALTranslate(out_envi_path.toUtf8().constData(), ds.get(), psOptions, NULL)); - GDALTranslateOptionsFree(psOptions); - return 0; -} - -int ENVI2TIFF(QString in_envi_path, QString out_tiff_path) -{ - std::shared_ptr ds = OpenDataset(in_envi_path); - const char* args[] = { "-of", "Gtiff", NULL }; - GDALTranslateOptions* psOptions = GDALTranslateOptionsNew((char**)args, NULL); - GDALClose(GDALTranslate(out_tiff_path.toUtf8().constData(), ds.get(), psOptions, NULL)); - GDALTranslateOptionsFree(psOptions); - return 0; -} - -int CreateDataset(QString new_file_path, int height, int width, int band_num, double* gt, - QString projection, GDALDataType gdal_dtype, bool need_gt) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - std::shared_ptr poDstDS(poDriver->Create(new_file_path.toUtf8().constData(), width, - height, band_num, gdal_dtype, NULL)); - if(need_gt) { - poDstDS->SetProjection(projection.toUtf8().constData()); - poDstDS->SetGeoTransform(gt); - } else { - } - GDALFlushCache((GDALDatasetH)poDstDS.get()); - return 0; -} - -int saveDataset(QString new_file_path, int start_line, int start_cols, int band_ids, int datacols, - int datarows, void* databuffer) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - std::shared_ptr poDstDS = OpenDataset(new_file_path, GA_Update); - GDALDataType gdal_datatype = poDstDS->GetRasterBand(1)->GetRasterDataType(); - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_cols, start_line, datacols, datarows, - databuffer, datacols, datarows, gdal_datatype, 0, 0); - GDALFlushCache(poDstDS.get()); - return 0; -} - -int block_num_pre_memory(int block_width, int height, GDALDataType gdal_datatype, double memey_size) -{ - // 计算大小 - int size_meta = 0; - - if(gdal_datatype == GDT_Byte) { - size_meta = 1; - } else if(gdal_datatype == GDT_UInt16) { - size_meta = 2; // 只有双通道才能构建 复数矩阵 - } else if(gdal_datatype == GDT_UInt16) { - size_meta = 2; - } else if(gdal_datatype == GDT_Int16) { - size_meta = 2; - } else if(gdal_datatype == GDT_UInt32) { - size_meta = 4; - } else if(gdal_datatype == GDT_Int32) { - size_meta = 4; - } - // else if (gdal_datatype == GDT_UInt64) { - // size_meta = 8; - // } - // else if (gdal_datatype == GDT_Int64) { - // size_meta = 8; - // } - else if(gdal_datatype == GDT_Float32) { - size_meta = 4; - } else if(gdal_datatype == GDT_Float64) { - size_meta = 4; - } else if(gdal_datatype == GDT_CInt16) { - size_meta = 2; - } else if(gdal_datatype == GDT_CInt32) { - size_meta = 2; - } else if(gdal_datatype == GDT_CFloat32) { - size_meta = 4; - } else if(gdal_datatype == GDT_CFloat64) { - size_meta = 8; - } else { - } - int block_num = int(memey_size / (size_meta * block_width)); - block_num = block_num > height ? height : block_num; // 行数 - block_num = block_num < 1 ? 1 : block_num; - return block_num; -} - -Eigen::Matrix -ReadComplexMatrixData(int start_line, int width, int line_num, - std::shared_ptr rasterDataset, GDALDataType gdal_datatype) -{ - int band_num = rasterDataset->GetRasterCount(); - if(gdal_datatype == 0) { - return Eigen::Matrix(0, 0); - } else if(gdal_datatype < 8) { - if(band_num != 2) { - return Eigen::Matrix(0, 0); - } - } else if(gdal_datatype < 12) { - if(band_num != 1) { - return Eigen::Matrix(0, 0); - } - - } else { - } - bool _flag = false; - Eigen::Matrix data_mat( - line_num * width, 2); // 必须强制行优先 - if(gdal_datatype == GDT_Byte) { - Eigen::MatrixX real_mat(line_num * width, 1); - Eigen::MatrixX imag_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, gdal_datatype, - 0, 0); // real - rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - imag_mat.data(), width, line_num, gdal_datatype, - 0, 0); // imag - data_mat.col(0) = (real_mat.array().cast()).array(); - data_mat.col(1) = (imag_mat.array().cast()).array(); - _flag = true; - } else if(gdal_datatype == GDT_UInt16) { - Eigen::MatrixX real_mat(line_num * width, 1); - Eigen::MatrixX imag_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, gdal_datatype, - 0, 0); // real - rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - imag_mat.data(), width, line_num, gdal_datatype, - 0, 0); // imag - data_mat.col(0) = (real_mat.array().cast()).array(); - data_mat.col(1) = (imag_mat.array().cast()).array(); - _flag = true; - } else if(gdal_datatype == GDT_Int16) { - Eigen::MatrixX real_mat(line_num * width, 1); - Eigen::MatrixX imag_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, gdal_datatype, - 0, 0); // real - rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - imag_mat.data(), width, line_num, gdal_datatype, - 0, 0); // imag - data_mat.col(0) = (real_mat.array().cast()).array(); - data_mat.col(1) = (imag_mat.array().cast()).array(); - _flag = true; - } else if(gdal_datatype == GDT_UInt32) { - Eigen::MatrixX real_mat(line_num * width, 1); - Eigen::MatrixX imag_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, gdal_datatype, - 0, 0); // real - rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - imag_mat.data(), width, line_num, gdal_datatype, - 0, 0); // imag - data_mat.col(0) = (real_mat.array().cast()).array(); - data_mat.col(1) = (imag_mat.array().cast()).array(); - _flag = true; - } else if(gdal_datatype == GDT_Int32) { - Eigen::MatrixX real_mat(line_num * width, 1); - Eigen::MatrixX imag_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, gdal_datatype, - 0, 0); // real - rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - imag_mat.data(), width, line_num, gdal_datatype, - 0, 0); // imag - data_mat.col(0) = (real_mat.array().cast()).array(); - data_mat.col(1) = (imag_mat.array().cast()).array(); - _flag = true; - } - // else if (gdal_datatype == GDT_UInt64) { - // Eigen::MatrixX real_mat(line_num * width, 1); - // Eigen::MatrixX imag_mat(line_num * width, 1); - // rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - //real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real - // rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - //imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag data_mat.col(0) = - //(real_mat.array().cast()).array(); data_mat.col(1) = - //(imag_mat.array().cast()).array(); _flag = true; - // } - // else if (gdal_datatype == GDT_Int64) { - // Eigen::MatrixX real_mat(line_num * width, 1); - // Eigen::MatrixX imag_mat(line_num * width, 1); - // rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - //real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real - // rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - //imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag data_mat.col(0) = - //(real_mat.array().cast()).array(); data_mat.col(1) = - //(imag_mat.array().cast()).array(); _flag = true; - // } - else if(gdal_datatype == GDT_Float32) { - Eigen::MatrixX real_mat(line_num * width, 1); - Eigen::MatrixX imag_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, gdal_datatype, - 0, 0); // real - rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - imag_mat.data(), width, line_num, gdal_datatype, - 0, 0); // imag - data_mat.col(0) = (real_mat.array().cast()).array(); - data_mat.col(1) = (imag_mat.array().cast()).array(); - _flag = true; - } else if(gdal_datatype == GDT_Float64) { - Eigen::MatrixX real_mat(line_num * width, 1); - Eigen::MatrixX imag_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, gdal_datatype, - 0, 0); // real - rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - imag_mat.data(), width, line_num, gdal_datatype, - 0, 0); // imag - data_mat.col(0) = (real_mat.array().cast()).array(); - data_mat.col(1) = (imag_mat.array().cast()).array(); - _flag = true; - } else if(gdal_datatype == GDT_CInt16) { - Eigen::MatrixX> complex_short_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - complex_short_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = (complex_short_mat.real().array().cast()).array(); - data_mat.col(1) = (complex_short_mat.imag().array().cast()).array(); - _flag = true; - } else if(gdal_datatype == GDT_CInt32) { - Eigen::MatrixX> complex_short_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - complex_short_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = (complex_short_mat.real().array().cast()).array(); - data_mat.col(1) = (complex_short_mat.imag().array().cast()).array(); - _flag = true; - } else if(gdal_datatype == GDT_CFloat32) { - Eigen::MatrixX> complex_short_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - complex_short_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = (complex_short_mat.real().array().cast()).array(); - data_mat.col(1) = (complex_short_mat.imag().array().cast()).array(); - _flag = true; - } else if(gdal_datatype == GDT_CFloat64) { - Eigen::MatrixX> complex_short_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - complex_short_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = (complex_short_mat.real().array().cast()).array(); - data_mat.col(1) = (complex_short_mat.imag().array().cast()).array(); - _flag = true; - } else { - } - // 保存数据 - - if(_flag) { - return data_mat; - } else { - return Eigen::Matrix( - 0, 0); // 必须强制行优先; - } -} - -Eigen::Matrix -ReadMatrixDoubleData(int start_line, int width, int line_num, - std::shared_ptr rasterDataset, GDALDataType gdal_datatype, - int band_idx) -{ - // 构建矩阵块,使用eigen 进行矩阵计算,加速计算 - bool _flag = false; - Eigen::Matrix data_mat( - line_num * width, 1); // 必须强制行优先 - if(gdal_datatype == GDT_Byte) { - Eigen::MatrixX real_mat(line_num * width, 1); - rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = ((real_mat.array().cast()).array().pow(2)).log10() * 10.0; - _flag = true; - } else if(gdal_datatype == GDT_UInt16) { - Eigen::MatrixX real_mat(line_num * width, 1); - rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = ((real_mat.array().cast()).array().pow(2)).log10() * 10.0; - _flag = true; - } else if(gdal_datatype == GDT_Int16) { - Eigen::MatrixX real_mat(line_num * width, 1); - rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = ((real_mat.array().cast()).array().pow(2)).log10() * 10.0; - _flag = true; - } else if(gdal_datatype == GDT_UInt32) { - Eigen::MatrixX real_mat(line_num * width, 1); - rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = ((real_mat.array().cast()).array().pow(2)).log10() * 10.0; - _flag = true; - } else if(gdal_datatype == GDT_Int32) { - Eigen::MatrixX real_mat(line_num * width, 1); - rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = ((real_mat.array().cast()).array().pow(2)).log10() * 10.0; - _flag = true; - } - // else if (gdal_datatype == GDT_UInt64) { - // Eigen::MatrixX real_mat(line_num * width, 1); - // rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - //real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real data_mat.col(0) = - //((real_mat.array().cast()).array().pow(2)).log10() * 10.0; _flag = true; - // } - // else if (gdal_datatype == GDT_Int64) { - // Eigen::MatrixX real_mat(line_num * width, 1); - // rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - //real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real data_mat.col(0) = - //((real_mat.array().cast()).array().pow(2)).log10() * 10.0; _flag = true; - // } - else if(gdal_datatype == GDT_Float32) { - Eigen::MatrixX real_mat(line_num * width, 1); - rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = ((real_mat.array().cast()).array().pow(2)).log10() * 10.0; - _flag = true; - } else if(gdal_datatype == GDT_Float64) { - Eigen::MatrixX real_mat(line_num * width, 1); - rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = ((real_mat.array().cast()).array().pow(2)).log10() * 10.0; - _flag = true; - } else { - } - - return data_mat; -} - -Eigen::MatrixXd getGeoTranslationArray(QString in_path) -{ - return Eigen::MatrixXd(); -} - -ImageGEOINFO getImageINFO(QString in_path) -{ - std::shared_ptr df = OpenDataset(in_path); - int width = df->GetRasterXSize(); - int heigh = df->GetRasterYSize(); - int band_num = df->GetRasterCount(); - ImageGEOINFO result; - result.width = width; - result.height = heigh; - result.bandnum = band_num; - - return result; -} - -GDALDataType getGDALDataType(QString fileptah) -{ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen( - fileptah.toUtf8().constData(), GA_ReadOnly)); // 锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷 - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - - GDALClose((GDALDatasetH)rasterDataset); - omp_unset_lock(&lock); // 锟酵放伙拷斤拷 - omp_destroy_lock(&lock); // 劫伙拷斤拷 - - return gdal_datatype; -} - - -int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int new_width, - int new_height, GDALResampleAlg eResample) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO"); - GDALDataset* pDSrc = (GDALDataset*)GDALOpen(pszSrcFile, GA_ReadOnly); - if(pDSrc == NULL) { - return -1; - } - - GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - if(pDriver == NULL) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -2; - } - int width = pDSrc->GetRasterXSize(); - int height = pDSrc->GetRasterYSize(); - int nBandCount = pDSrc->GetRasterCount(); - GDALDataType dataType = pDSrc->GetRasterBand(1)->GetRasterDataType(); - - char* pszSrcWKT = NULL; - pszSrcWKT = const_cast(pDSrc->GetProjectionRef()); - - // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7 - if(strlen(pszSrcWKT) <= 0) { - OGRSpatialReference oSRS; - oSRS.importFromEPSG(4326); - // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷 - // oSRS.SetWellKnownGeogCS("WGS84"); - oSRS.exportToWkt(&pszSrcWKT); - } - qDebug() << "GDALCreateGenImgProjTransformer " << Qt::endl; - void* hTransformArg; - hTransformArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, NULL, pszSrcWKT, - FALSE, 0.0, 1); - qDebug() << "no proj " << Qt::endl; - //(没锟斤拷投影锟斤拷影锟斤拷锟斤拷锟斤拷锟斤拷卟锟酵?拷锟?1锟?7) - if(hTransformArg == NULL) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -3; - } - qDebug() << "has proj " << Qt::endl; - double dGeoTrans[6] = { 0 }; - int nNewWidth = 0, nNewHeight = 0; - if(GDALSuggestedWarpOutput((GDALDatasetH)pDSrc, GDALGenImgProjTransform, hTransformArg, - dGeoTrans, &nNewWidth, &nNewHeight) - != CE_None) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -3; - } - - // GDALDestroyGenImgProjTransformer(hTransformArg); - qDebug() << "create init GDALDataset " ; - GDALDataset* pDDst = - pDriver->Create(pszOutFile, new_width, new_height, nBandCount, dataType, NULL); - if(pDDst == NULL) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -2; - } - - pDDst->SetProjection(pszSrcWKT); - pDDst->SetGeoTransform(gt); - - GDALWarpOptions* psWo = GDALCreateWarpOptions(); - CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // 使用所有可用的CPU核心 - CPLSetConfigOption("GDAL_CACHEMAX", "16000"); // 设置缓存大小为500MB - // psWo->papszWarpOptions = CSLDuplicate(NULL); - psWo->eWorkingDataType = dataType; - psWo->eResampleAlg = eResample; - - psWo->hSrcDS = (GDALDatasetH)pDSrc; - psWo->hDstDS = (GDALDatasetH)pDDst; - qDebug() << "GDALCreateGenImgProjTransformer" << Qt::endl; - psWo->pfnTransformer = GDALGenImgProjTransform; - psWo->pTransformerArg = GDALCreateGenImgProjTransformer( - (GDALDatasetH)pDSrc, pszSrcWKT, (GDALDatasetH)pDDst, pszSrcWKT, FALSE, 0.0, 1); - ; - - qDebug() << "GDALCreateGenImgProjTransformer has created" << Qt::endl; - psWo->nBandCount = nBandCount; - psWo->panSrcBands = (int*)CPLMalloc(nBandCount * sizeof(int)); - psWo->panDstBands = (int*)CPLMalloc(nBandCount * sizeof(int)); - for(int i = 0; i < nBandCount; i++) { - psWo->panSrcBands[i] = i + 1; - psWo->panDstBands[i] = i + 1; - } - - GDALWarpOperation oWo; - if(oWo.Initialize(psWo) != CE_None) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - return -3; - } - qDebug() << "ChunkAndWarpImage:" << new_width << "," << new_height << Qt::endl; - oWo.ChunkAndWarpMulti(0, 0, new_width, new_height); - GDALFlushCache(pDDst); - qDebug() << "ChunkAndWarpImage over" << Qt::endl; - // GDALDestroyGenImgProjTransformer(psWo->pTransformerArg); - // GDALDestroyWarpOptions(psWo); - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - return 0; -} - -int ResampleGDALs(const char* pszSrcFile, int band_ids, GDALRIOResampleAlg eResample) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO"); - GDALDataset* pDSrc = (GDALDataset*)GDALOpen(pszSrcFile, GA_Update); - if(pDSrc == NULL) { - return -1; - } - - GDALDataType gdal_datatype = pDSrc->GetRasterBand(1)->GetRasterDataType(); - - GDALRasterBand* demBand = pDSrc->GetRasterBand(band_ids); - - int width = pDSrc->GetRasterXSize(); - int height = pDSrc->GetRasterYSize(); - int start_col = 0, start_row = 0, rows_count = 0, cols_count; - - int row_delta = int(120000000 / width); - - GDALRasterIOExtraArg psExtraArg; - INIT_RASTERIO_EXTRA_ARG(psExtraArg); - psExtraArg.eResampleAlg = eResample; - - do { - rows_count = start_row + row_delta < height ? row_delta : height - start_row; - cols_count = width; - - if(gdal_datatype == GDALDataType::GDT_UInt16) { - unsigned short* temp = new unsigned short[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, - cols_count, rows_count, gdal_datatype, 0, 0); - demBand->RasterIO(GF_Write, start_col, start_row, cols_count, rows_count, temp, - cols_count, rows_count, gdal_datatype, 0, 0, &psExtraArg); - delete[] temp; - - } else if(gdal_datatype == GDALDataType::GDT_Int16) { - short* temp = new short[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, - cols_count, rows_count, gdal_datatype, 0, 0); - demBand->RasterIO(GF_Write, start_col, start_row, cols_count, rows_count, temp, - cols_count, rows_count, gdal_datatype, 0, 0, &psExtraArg); - delete[] temp; - } else if(gdal_datatype == GDALDataType::GDT_Float32) { - float* temp = new float[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, - cols_count, rows_count, gdal_datatype, 0, 0); - demBand->RasterIO(GF_Write, start_col, start_row, cols_count, rows_count, temp, - cols_count, rows_count, gdal_datatype, 0, 0, &psExtraArg); - delete[] temp; - } - start_row = start_row + rows_count; - } while(start_row < height); - GDALClose((GDALDatasetH)pDSrc); - - return 0; -} - -int alignRaster(QString inputPath, QString referencePath, QString outputPath, GDALResampleAlg eResample) -{ - - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - GDALDataset* pDSrc = (GDALDataset*)GDALOpen(inputPath.toUtf8().constData(), GA_ReadOnly); - if (pDSrc == NULL) { - return -1; - } - - GDALDataset* tDSrc = (GDALDataset*)GDALOpen(referencePath.toUtf8().constData(), GA_ReadOnly); - if (tDSrc == NULL) { - return -1; - } - - long new_width = tDSrc->GetRasterXSize(); - long new_height = tDSrc->GetRasterYSize(); - - GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - if (pDriver == NULL) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -2; - } - int width = pDSrc->GetRasterXSize(); - int height = pDSrc->GetRasterYSize(); - int nBandCount = pDSrc->GetRasterCount(); - GDALDataType dataType = pDSrc->GetRasterBand(1)->GetRasterDataType(); - - char* pszSrcWKT = NULL; - pszSrcWKT = const_cast(pDSrc->GetProjectionRef()); - - if (strlen(pszSrcWKT) <= 0) { - OGRSpatialReference oSRS; - oSRS.importFromEPSG(4326); - oSRS.exportToWkt(&pszSrcWKT); - } - qDebug() << "GDALCreateGenImgProjTransformer " << Qt::endl; - void* hTransformArg; - hTransformArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, NULL, pszSrcWKT,FALSE, 0.0, 1); - qDebug() << "no proj " << Qt::endl; - if (hTransformArg == NULL) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -3; - } - qDebug() << "has proj " << Qt::endl; - std::shared_ptr dGeoTrans(new double[6], delArrPtr); - int nNewWidth = 0, - nNewHeight = 0; - - if (GDALSuggestedWarpOutput((GDALDatasetH)pDSrc, GDALGenImgProjTransform, hTransformArg,dGeoTrans.get(), &nNewWidth, &nNewHeight) != CE_None) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -3; - } - - GDALDataset* pDDst = pDriver->Create(outputPath.toUtf8().constData(), new_width, new_height, pDSrc->GetRasterCount(), dataType, NULL); - if (pDDst == NULL) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -2; - } - - std::shared_ptr gt(new double[6], delArrPtr); - tDSrc->GetGeoTransform(gt.get()); - pDDst->SetProjection(pszSrcWKT); - pDDst->SetGeoTransform(gt.get()); - - GDALWarpOptions* psWo = GDALCreateWarpOptions(); - - psWo->eWorkingDataType = dataType; - psWo->eResampleAlg = eResample; - - psWo->hSrcDS = (GDALDatasetH)pDSrc; - psWo->hDstDS = (GDALDatasetH)pDDst; - - psWo->pfnTransformer = GDALGenImgProjTransform; - psWo->pTransformerArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, (GDALDatasetH)pDDst, pszSrcWKT, FALSE, 0.0, 1); - - - qDebug() << "GDALCreateGenImgProjTransformer has created" << Qt::endl; - psWo->nBandCount = nBandCount; - psWo->panSrcBands = (int*)CPLMalloc(nBandCount * sizeof(int)); - psWo->panDstBands = (int*)CPLMalloc(nBandCount * sizeof(int)); - for (int i = 0; i < nBandCount; i++) { - psWo->panSrcBands[i] = i + 1; - psWo->panDstBands[i] = i + 1; - } - - GDALWarpOperation oWo; - if (oWo.Initialize(psWo) != CE_None) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALClose((GDALDatasetH)(GDALDatasetH)tDSrc); - return -3; - } - qDebug() << "ChunkAndWarpImage:" << new_width << "," << new_height << Qt::endl; - oWo.ChunkAndWarpMulti(0, 0, new_width, new_height); - GDALFlushCache(pDDst); - qDebug() << "ChunkAndWarpImage over" << Qt::endl; - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALClose((GDALDatasetH)(GDALDatasetH)tDSrc); - return 0; - - -} - - -int saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path) -{ - int rows = data.rows(); - int cols = data.cols(); - - Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3); - - gdalImage image_tiff = - CreategdalImage(out_tiff_path, rows, cols, 2, gt, "", false, true); // 注意这里保留仿真结果 - // 保存二进制文件 - Eigen::MatrixXd real_img = data.array().real(); - Eigen::MatrixXd imag_img = data.array().imag(); - image_tiff.saveImage(real_img, 0, 0, 1); - image_tiff.saveImage(imag_img, 0, 0, 2); - return -1; -} - -void clipRaster(QString inRasterPath, QString outRasterPath, long minRow, long maxRow, long minCol, long maxCol) -{ - long rownum = maxRow - minRow + 1; - long colnum = maxCol - minCol + 1; - - gdalImage inimg(inRasterPath); - Eigen::MatrixXd gt = inimg.gt; - - Landpoint lp = inimg.getLandPoint(minRow, minCol, 0); - - gt(0, 0) = lp.lon; - gt(1, 0) = lp.lat; - - gdalImage outimg= CreategdalImageDouble(outRasterPath, rownum, colnum, inimg.band_num, gt, inimg.projection, true, true, true); - - for (long bi = 1; bi < inimg.band_num + 1; bi++) { - Eigen::MatrixXd brasterData = inimg.getData(minRow, minCol, rownum, colnum, bi); - outimg.saveImage(brasterData, 0, 0, bi); - qDebug() << "writer raster band : " << bi; - } - - qDebug() << "writer raster overring"; - -} - - - - -long getProjectEPSGCodeByLon_Lat(double long, double lat, ProjectStripDelta stripState) -{ - long EPSGCode = 0; - switch (stripState) { - case ProjectStripDelta::Strip_3: { - break; - }; - case ProjectStripDelta::Strip_6: { - break; - } - default: { - EPSGCode = -1; - break; - } - } - qDebug() << QString(" EPSG code : %1").arg(EPSGCode); - return EPSGCode; -} -long getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat) -{ - // EPSG 4534 ~ 4554 3 度带 - // 首先判断是否是在 中国带宽范围 - // 中心经度范围 :75E ~ 135E 实际范围 73.5E ~ 136.5E, - // 纬度范围 3N ~ 54N,放宽到 0N~ 60N - if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // 中国境内 - long code = trunc((lon - 73.5) / 3) + 4534; - return code; - } - else { // 非中国境内 使用 高斯克吕格 - bool isSouth = lat < 0; // 简单判断南北半球,这里仅为示例,实际应用可能需要更细致的逻辑 - long prefix = isSouth ? 327000 : 326000; - // std::string prefix = isSouth ? "327" : "326"; - lon = fmod(lon + 360.0, 360.0); - long zone = std::floor((lon + 180.0) / 3.0); - prefix = prefix + zone; - return prefix; - } - return 0; -} -long getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat) -{ - // EPSG 4502 ~ 4512 6度带 - // 首先判断是否是在 中国带宽范围 - // 中心经度范围 :75E ~ 135E 实际范围 72.0E ~ 138E, - // 纬度范围 3N ~ 54N,放宽到 0N~ 60N - if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // 中国境内 - long code = trunc((lon - 72.0) / 6) + 4502; - return code; - } - else { // 非中国境内 使用 UTM// 确定带号,6度带从1开始到60,每6度一个带 - int zone = static_cast((lon + 180.0) / 6.0) + 1; - bool isSouth = lon < 0; // 判断是否在南半球 - long epsgCodeBase = isSouth ? 32700 : 32600; // 计算EPSG代码 - long prefix = static_cast(epsgCodeBase + zone); - return prefix; - } - return 0; -} - -QString GetProjectionNameFromEPSG(long epsgCode) -{ - qDebug() << "============= GetProjectionNameFromEPSG ======================"; - OGRSpatialReference oSRS; - - // 设置EPSG代码 - if (oSRS.importFromEPSG(epsgCode) != OGRERR_NONE) { - qDebug() << "epsgcode not recognition"; - return ""; - } - - // 获取并输出坐标系的描述(名称) - const char* pszName = oSRS.GetAttrValue("GEOGCS"); - if (pszName) { - qDebug() << "Coordinate system name for EPSG " + QString::number(epsgCode) - << " is: " + QString::fromStdString(pszName); - return QString::fromStdString(pszName); - } - else { - qDebug() << "Unable to retrieve the name for EPSG " + QString::number(epsgCode); - return ""; - } - - // char* wkt = NULL; - // // 转换为WKT格式 - // oSRS.exportToWkt(&wkt); - // - // qDebug() << wkt; - // - // // 从WKT中解析投影名称,这里简化处理,实际可能需要更复杂的逻辑来准确提取名称 - // std::string wktStr(wkt); - // long start = wktStr.find("PROJCS[\"") + 8; // 找到"PROJCS["后的第一个双引号位置 - // // 从start位置开始找下一个双引号,这之间的内容即为投影名称 - // int end = wktStr.find('\"', start); - // QString projName = QString::fromStdString(wktStr.substr(start, end - start)); - // - // // 释放WKT字符串内存 - // CPLFree(wkt); - - // return projName; -} - - - -long GetEPSGFromRasterFile(QString filepath) -{ - qDebug() << "============= GetEPSGFromRasterFile ======================"; - // QTextCodec* codec = QTextCodec::codecForLocale(); // 获取系统默认编码的文本编解码器 - // QByteArray byteArray = codec->fromUnicode(filepath); // 将QString转换为QByteArray - //,这个应该会自动释放 const char* charArray = byteArray.constData(); // - // 获取QByteArray的const char*指针 - - { - if (QFile(filepath).exists()) { - qDebug() << "info: the image found.\n"; - } - else { - return -1; - } - - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // 注册GDAL驱动 - // qDebug()<GetProjectionRef(); - - qDebug() << QString::fromUtf8(pszProjection); - - // 创建SpatialReference对象 - OGRSpatialReference oSRS; - if (oSRS.importFromWkt((char**)&pszProjection) != OGRERR_NONE) { - qDebug() << ("Error: Unable to import projection information.\n"); - GDALClose(poDataset); - return -1; - } - - qDebug() << pszProjection ; - - const char* epscodestr = oSRS.GetAuthorityCode(nullptr); - if (NULL == epscodestr || nullptr == epscodestr) { - qDebug() << "EPSG code string could not be determined from the spatial reference."; - GDALClose(poDataset); - - return -1; - } - long epsgCode = atoi(epscodestr); // 获取EPSG代码 - - if (epsgCode != 0) { - GDALClose(poDataset); - qDebug() << QString("file %1 :epsg Code %2").arg(filepath).arg(epsgCode); - return epsgCode; - } - else { - qDebug() << "EPSG code could not be determined from the spatial reference."; - GDALClose(poDataset); - - return -1; - } - } -} - -std::shared_ptr GetCenterPointInRaster(QString filepath) -{ - qDebug() << "============= GetCenterPointInRaster ======================"; - // QTextCodec* codec = QTextCodec::codecForLocale(); // 获取系统默认编码的文本编解码器 - // QByteArray byteArray = codec->fromUnicode(filepath); // 将QString转换为QByteArray - //,这个应该会自动释放 const char* charArray = byteArray.constData(); // - // 获取QByteArray的const char*指针 - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - // qDebug()<GetGeoTransform(adfGeoTransform) != CE_None) { - qDebug() << "Failed to get GeoTransform"; - return nullptr; - } - - double dfWidth = poDataset->GetRasterXSize(); - double dfHeight = poDataset->GetRasterYSize(); - - // 计算中心点坐标(像素坐标) - double dfCenterX = adfGeoTransform[0] + dfWidth * adfGeoTransform[1] / 2.0 - + dfHeight * adfGeoTransform[2] / 2.0; - double dfCenterY = adfGeoTransform[3] + dfWidth * adfGeoTransform[4] / 2.0 - + dfHeight * adfGeoTransform[5] / 2.0; - - OGRSpatialReference oSRS; - oSRS.importFromWkt(poDataset->GetProjectionRef()); - - if (oSRS.IsGeographic()) { - qDebug() << "Center coords (already in geographic): (" + QString::number(dfCenterX) - + ", " + QString::number(dfCenterY) + ")"; - flag = true; - x = dfCenterX; - y = dfCenterY; - } - else { - // 如果不是地理坐标系,转换到WGS84 - OGRSpatialReference oSRS_WGS84; - oSRS_WGS84.SetWellKnownGeogCS("WGS84"); - - OGRCoordinateTransformation* poCT = - OGRCreateCoordinateTransformation(&oSRS, &oSRS_WGS84); - if (poCT == nullptr) { - qDebug() << "Failed to create coordinate transformation"; - return nullptr; - } - - // double dfLon, dfLat; - if (poCT->Transform(1, &dfCenterX, &dfCenterY)) { - qDebug() << "Center coords (transformed to WGS84): (" - + QString::number(dfCenterX) + ", " + QString::number(dfCenterY) - << ")"; - flag = true; - x = dfCenterX; - y = dfCenterY; - } - else { - qDebug() << "Transformation failed."; - } - OGRCoordinateTransformation::DestroyCT(poCT); - } - } - if (nullptr == poDataset || NULL == poDataset) {} - else { - GDALClose(poDataset); - } - - if (flag) { - std::shared_ptr RasterCenterPoint = std::make_shared(); - RasterCenterPoint->x = x; - RasterCenterPoint->y = y; - RasterCenterPoint->z = 0; - return RasterCenterPoint; - } - else { - return nullptr; - } -} -CoordinateSystemType getCoordinateSystemTypeByEPSGCode(long epsg_code) -{ - OGRSpatialReference oSRS; - if (oSRS.importFromEPSG(epsg_code) == OGRERR_NONE) { - if (oSRS.IsGeographic()) { - return CoordinateSystemType::GeoCoordinateSystem; - } - else if (oSRS.IsProjected()) { - return CoordinateSystemType::ProjectCoordinateSystem; - } - else { - return CoordinateSystemType::UNKNOW; - } - } - else { - return CoordinateSystemType::UNKNOW; - } -} - - -void resampleRaster(const char* inputRaster, const char* outputRaster, double targetPixelSizeX, double targetPixelSizeY) { - // 初始化GDAL - GDALAllRegister(); - // 打开输入栅格文件 - GDALDataset* poDataset = (GDALDataset*)GDALOpen(inputRaster, GA_ReadOnly); - if (poDataset == nullptr) { - std::cerr << "Failed to open raster file." << std::endl; - return; - } - - // 获取原始栅格的空间参考 - double adfGeoTransform[6]; - if (poDataset->GetGeoTransform(adfGeoTransform) != CE_None) { - std::cerr << "Failed to get geotransform." << std::endl; - GDALClose(poDataset); - return; - } - - // 获取原始栅格的尺寸 - int nXSize = poDataset->GetRasterXSize(); - int nYSize = poDataset->GetRasterYSize(); - - // 计算目标栅格的尺寸 - double targetXSize = (adfGeoTransform[1] * nXSize) / targetPixelSizeX; - double targetYSize = (adfGeoTransform[5] * nYSize) / targetPixelSizeY; - - // 创建目标数据集(输出栅格) - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - if (poDriver == nullptr) { - std::cerr << "Failed to get GTiff driver." << std::endl; - GDALClose(poDataset); - return; - } - - // 创建输出数据集 - GDALDataset* poOutDataset = poDriver->Create(outputRaster, (int)targetXSize, (int)targetYSize, poDataset->GetRasterCount(), GDT_Float32, nullptr); - if (poOutDataset == nullptr) { - std::cerr << "Failed to create output raster." << std::endl; - GDALClose(poDataset); - return; - } - - // 设置输出数据集的地理变换(坐标系) - double targetGeoTransform[6] = { - adfGeoTransform[0], targetPixelSizeX, 0, adfGeoTransform[3], 0, -targetPixelSizeY - }; - poOutDataset->SetGeoTransform(targetGeoTransform); - - // 设置输出数据集的投影信息 - poOutDataset->SetProjection(poDataset->GetProjectionRef()); - - // 进行重采样 - for (int i = 0; i < poDataset->GetRasterCount(); i++) { - GDALRasterBand* poBand = poDataset->GetRasterBand(i + 1); - GDALRasterBand* poOutBand = poOutDataset->GetRasterBand(i + 1); - - // 使用GDAL的重采样方法,选择一个适当的重采样方式 - poOutBand->RasterIO(GF_Write, 0, 0, (int)targetXSize, (int)targetYSize, - nullptr, (int)targetXSize, (int)targetYSize, - poBand->GetRasterDataType(), 0, 0, nullptr); - } - - // 关闭数据集 - GDALClose(poDataset); - GDALClose(poOutDataset); - - qDebug() << "Resampling completed." ; -} - -void transformRaster(const char* inputFile, const char* outputFile, int sourceEPSG, int targetEPSG) { - // 初始化 GDAL 库 - GDALAllRegister(); - - // 打开源栅格文件 - GDALDataset* poSrcDS = (GDALDataset*)GDALOpen(inputFile, GA_ReadOnly); - if (poSrcDS == nullptr) { - qDebug() << "Failed to open input file:" << inputFile; - return; - } - - // 获取源栅格的基本信息 - int nXSize = poSrcDS->GetRasterXSize(); - int nYSize = poSrcDS->GetRasterYSize(); - int nBands = poSrcDS->GetRasterCount(); - GDALDataType eDT = poSrcDS->GetRasterBand(1)->GetRasterDataType(); - - // 创建目标栅格文件 - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - if (poDriver == nullptr) { - qDebug() << "GTiff driver not available."; - GDALClose(poSrcDS); - return; - } - - GDALDataset* poDstDS = poDriver->Create(outputFile, nXSize, nYSize, nBands, eDT, nullptr); - if (poDstDS == nullptr) { - qDebug() << "Failed to create output file:" << outputFile; - GDALClose(poSrcDS); - return; - } - - // 设置目标栅格的空间参考系统 - OGRSpatialReference oSRS; - oSRS.importFromEPSG(targetEPSG); - - char* pszWKT = nullptr; - oSRS.exportToWkt(&pszWKT); - poDstDS->SetProjection(pszWKT); - CPLFree(pszWKT); - - // 复制元数据 - poDstDS->SetMetadata(poSrcDS->GetMetadata()); - - // 复制每个波段的数据 - for (int i = 1; i <= nBands; ++i) { - GDALRasterBand* poSrcBand = poSrcDS->GetRasterBand(i); - GDALRasterBand* poDstBand = poDstDS->GetRasterBand(i); - - float* pafScanline = (float*)CPLMalloc(sizeof(float) * nXSize); - - for (int j = 0; j < nYSize; ++j) { - poSrcBand->RasterIO(GF_Read, 0, j, nXSize, 1, pafScanline, nXSize, 1, GDT_Float32, 0, 0); - poDstBand->RasterIO(GF_Write, 0, j, nXSize, 1, pafScanline, nXSize, 1, GDT_Float32, 0, 0); - } - - CPLFree(pafScanline); - } - - // 关闭数据集 - GDALClose(poSrcDS); - GDALClose(poDstDS); - - qDebug() << "Raster transformation completed successfully."; -} - - - -ErrorCode transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG, Point2 &p) { - // 创建源坐标系(原始坐标系) - OGRSpatialReference sourceSRS; - sourceSRS.importFromEPSG(sourceEPSG); // 使用 EPSG 编码来指定坐标系 - - // 创建目标坐标系(目标坐标系) - OGRSpatialReference targetSRS; - targetSRS.importFromEPSG(targetEPSG); // WGS84 坐标系 EPSG:4326 - - // 创建坐标变换对象 - OGRCoordinateTransformation* transform = OGRCreateCoordinateTransformation(&sourceSRS, &targetSRS); - if (transform == nullptr) { - qDebug() << "Failed to create coordinate transformation." ; - return ErrorCode::FAIL; - } - - // 转换坐标 - double transformedX = x; - double transformedY = y; - if (transform->Transform(1, &transformedX, &transformedY)) { - qDebug() << "Original Coordinates: (" << x << ", " << y << ")" ; - qDebug() << "Transformed Coordinates (EPSG:" << targetEPSG << "): (" << transformedX << ", " << transformedY << ")" ; - } - else { - qDebug() << "Coordinate transformation failed." ; - } - - // 清理 - delete transform; - p.x = transformedX; - p.y = transformedY; - return ErrorCode::SUCCESS; - -} - -void cropRasterByLatLon(const char* inputFile, const char* outputFile,double minLon, double maxLon, double minLat, double maxLat) { - // 初始化 GDAL 库 - GDALAllRegister(); - - // 打开栅格数据集 - GDALDataset* poDataset = (GDALDataset*)GDALOpen(inputFile, GA_ReadOnly); - if (poDataset == nullptr) { - std::cerr << "Failed to open input raster." << std::endl; - return; - } - - // 获取栅格数据的地理参考信息 - double adfGeoTransform[6]; - if (poDataset->GetGeoTransform(adfGeoTransform) != CE_None) { - std::cerr << "Failed to get geotransform." << std::endl; - GDALClose(poDataset); - return; - } - - // 获取输入影像的投影信息 - const char* projection = poDataset->GetProjectionRef(); - - // 根据经纬度计算出裁剪区域对应的栅格像素坐标 - int xMin = (int)((minLon - adfGeoTransform[0]) / adfGeoTransform[1]); - int xMax = (int)((maxLon - adfGeoTransform[0]) / adfGeoTransform[1]); - int yMin = (int)((maxLat - adfGeoTransform[3]) / adfGeoTransform[5]); - int yMax = (int)((minLat - adfGeoTransform[3]) / adfGeoTransform[5]); - - // 创建裁剪区域的目标栅格数据集 - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - if (poDriver == nullptr) { - std::cerr << "Failed to get GTiff driver." << std::endl; - GDALClose(poDataset); - return; - } - - // 创建输出栅格数据集,指定尺寸 - int width = xMax - xMin; - int height = yMax - yMin; - GDALDataset* poOutDataset = poDriver->Create(outputFile, width, height, poDataset->GetRasterCount(), GDT_Float32, nullptr); - if (poOutDataset == nullptr) { - std::cerr << "Failed to create output raster." << std::endl; - GDALClose(poDataset); - return; - } - - // 设置输出栅格的投影信息和地理变换 - poOutDataset->SetProjection(projection); - double newGeoTransform[6] = { adfGeoTransform[0] + xMin * adfGeoTransform[1], adfGeoTransform[1], 0.0, adfGeoTransform[3] + yMin * adfGeoTransform[5], 0.0, adfGeoTransform[5] }; - poOutDataset->SetGeoTransform(newGeoTransform); - - // 循环读取源数据并写入目标数据集 - for (int i = 0; i < poDataset->GetRasterCount(); ++i) { - GDALRasterBand* poBand = poDataset->GetRasterBand(i + 1); - GDALRasterBand* poOutBand = poOutDataset->GetRasterBand(i + 1); - - // 读取源数据 - int* pData = new int[width * height]; - poBand->RasterIO(GF_Read, xMin, yMin, width, height, pData, width, height, GDT_Int32, 0, 0); - - // 写入目标数据 - poOutBand->RasterIO(GF_Write, 0, 0, width, height, pData, width, height, GDT_Int32, 0, 0); - - delete[] pData; - } - - qDebug() << "Raster cropped and saved to: " << outputFile ; - - // 清理 - GDALClose(poDataset); - GDALClose(poOutDataset); -} - - -ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QString demsloperPath) -{ - gdalImage demds(dempath); - gdalImage demxyz = CreategdalImage(demxyzpath, demds.height, demds.width, 3, demds.gt, demds.projection, true, true);// X,Y,Z - - // 分块计算并转换为XYZ - - Eigen::MatrixXd demArr = demds.getData(0, 0, demds.height, demds.width, 1); - Eigen::MatrixXd demR = demArr; - Landpoint LandP{ 0,0,0 }; - Point3 GERpoint{ 0,0,0 }; - double R = 0; - double dem_row = 0, dem_col = 0, dem_alt = 0; - - long line_invert = 1000; - - double rowidx = 0; - double colidx = 0; - for (int max_rows_ids = 0; max_rows_ids < demds.height; max_rows_ids = max_rows_ids + line_invert) { - Eigen::MatrixXd demdata = demds.getData(max_rows_ids, 0, line_invert, demds.width, 1); - Eigen::MatrixXd xyzdata_x = demdata.array() * 0; - Eigen::MatrixXd xyzdata_y = demdata.array() * 0; - Eigen::MatrixXd xyzdata_z = demdata.array() * 0; - - int datarows = demdata.rows(); - int datacols = demdata.cols(); - - for (int i = 0; i < datarows; i++) { - for (int j = 0; j < datacols; j++) { - rowidx = i + max_rows_ids; - colidx = j; - demds.getLandPoint(rowidx, colidx, demdata(i, j), LandP); // 获取地理坐标 - LLA2XYZ(LandP, GERpoint); // 经纬度转换为地心坐标系 - xyzdata_x(i, j) = GERpoint.x; - xyzdata_y(i, j) = GERpoint.y; - xyzdata_z(i, j) = GERpoint.z; - } - } - demxyz.saveImage(xyzdata_x, max_rows_ids, 0, 1); - demxyz.saveImage(xyzdata_y, max_rows_ids, 0, 2); - demxyz.saveImage(xyzdata_z, max_rows_ids, 0, 3); - } - - - // 计算坡向角 - gdalImage demsloperxyz = CreategdalImage(demsloperPath, demds.height, demds.width, 4, demds.gt, demds.projection, true, true);// X,Y,Z,cosangle - - line_invert = 1000; - long start_ids = 0; - long dem_rows = 0, dem_cols = 0; - - for (start_ids = 1; start_ids < demds.height; start_ids = start_ids + line_invert) { - Eigen::MatrixXd demdata = demds.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 1); - long startlineid = start_ids; - Eigen::MatrixXd demsloper_x = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 1); - Eigen::MatrixXd demsloper_y = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 2); - Eigen::MatrixXd demsloper_z = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 3); - Eigen::MatrixXd demsloper_angle = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 4); - - Landpoint p0, p1, p2, p3, p4, pslopeVector, pp; - Vector3D slopeVector; - - dem_rows = demsloper_y.rows(); - dem_cols = demsloper_y.cols(); - double sloperAngle = 0; - Vector3D Zaxis = { 0,0,1 }; - - double rowidx = 0, colidx = 0; - - for (long i = 1; i < dem_rows - 1; i++) { - for (long j = 1; j < dem_cols - 1; j++) { - rowidx = i + startlineid; - colidx = j; - demds.getLandPoint(rowidx, colidx, demdata(i, j), p0); - demds.getLandPoint(rowidx - 1, colidx, demdata(i - 1, j), p1); - demds.getLandPoint(rowidx, colidx - 1, demdata(i, j - 1), p2); - demds.getLandPoint(rowidx + 1, colidx, demdata(i + 1, j), p3); - demds.getLandPoint(rowidx, colidx + 1, demdata(i, j + 1), p4); - - pslopeVector = getSlopeVector(p0, p1, p2, p3, p4); // 地面坡向矢量 - slopeVector = { pslopeVector.lon,pslopeVector.lat,pslopeVector.ati }; - pp = LLA2XYZ(p0); - Zaxis.x = pp.lon; - Zaxis.y = pp.lat; - Zaxis.z = pp.ati; - sloperAngle = getCosAngle(slopeVector, Zaxis); // 地面坡向角 - - demsloper_x(i, j) = slopeVector.x; - demsloper_y(i, j) = slopeVector.y; - demsloper_z(i, j) = slopeVector.z; - demsloper_angle(i, j) = sloperAngle; - } - } - demsloperxyz.saveImage(demsloper_x, start_ids - 1, 0, 1); - demsloperxyz.saveImage(demsloper_y, start_ids - 1, 0, 2); - demsloperxyz.saveImage(demsloper_z, start_ids - 1, 0, 3); - demsloperxyz.saveImage(demsloper_angle, start_ids - 1, 0, 4); - } - - - return ErrorCode::SUCCESS; -} - - -void ConvertCoordinateSystem(QString inRasterPath, QString outRasterPath, long outepsgcode) { - // 注册所有GDAL驱动 - GDALAllRegister(); - - // 打开输入栅格文件 - GDALDataset* srcDataset = (GDALDataset*)GDALOpen(inRasterPath.toUtf8().constData(), GA_ReadOnly); - if (!srcDataset) { - // 错误处理:输出文件打开失败 - // qDebug() << "无法打开输入文件:" << inRasterPath; - return; - } - - // 创建目标坐标系 - OGRSpatialReference targetSRS; - if (targetSRS.importFromEPSG(outepsgcode) != OGRERR_NONE) { - GDALClose(srcDataset); - // qDebug() << "无效的EPSG代码:" << outepsgcode; - return; - } - GDALDataType datetype = srcDataset->GetRasterBand(1)->GetRasterDataType(); - // 获取目标坐标系的WKT表示 - char* targetSRSWkt = nullptr; - targetSRS.exportToWkt(&targetSRSWkt); - - bool flag = (datetype == GDT_Byte || datetype == GDT_Int8 || datetype == GDT_Int16 ||datetype == GDT_UInt16 || datetype == GDT_Int32 || datetype == GDT_UInt32 || datetype == GDT_Int64 || datetype == GDT_UInt64); - - // 创建重投影后的虚拟数据集(Warped VRT) - GDALDataset* warpedVRT = flag? (GDALDataset*)GDALAutoCreateWarpedVRT( - srcDataset, - nullptr, // 输入坐标系(默认使用源数据) - targetSRSWkt, // 目标坐标系 - GRA_NearestNeighbour, // 重采样方法:双线性插值 - 0.0, // 最大误差(0表示自动计算) - nullptr // 其他选项 - ) :(GDALDataset*)GDALAutoCreateWarpedVRT( - srcDataset, - nullptr, // 输入坐标系(默认使用源数据) - targetSRSWkt, // 目标坐标系 - GRA_Bilinear, // 重采样方法:双线性插值 - 0.0, // 最大误差(0表示自动计算) - nullptr // 其他选项 - ); - CPLFree(targetSRSWkt); // 释放WKT内存 - - if (!warpedVRT) { - GDALClose(srcDataset); - qDebug() << u8"创建投影转换VRT失败"; - return; - } - - // 获取输出驱动(GeoTIFF格式) - QString filesuffer = getFileExtension(outRasterPath).toLower(); - bool isTiff = filesuffer.contains("tif"); - GDALDriver* driver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI"); - if (!driver) { - GDALClose(warpedVRT); - GDALClose(srcDataset); - // qDebug() << "无法获取GeoTIFF驱动"; - return; - } - - // 创建输出栅格文件 - GDALDataset* dstDataset = driver->CreateCopy( - outRasterPath.toUtf8().constData(), // 输出文件路径 - warpedVRT, // 输入数据集(VRT) - false, // 是否严格复制 - nullptr, // 创建选项 - nullptr, // 进度回调 - nullptr // 回调参数 - ); - - if (!dstDataset) { - // qDebug() << "创建输出文件失败:" << outRasterPath; - GDALClose(warpedVRT); - GDALClose(srcDataset); - return; - } - - // 释放资源 - GDALClose(dstDataset); - GDALClose(warpedVRT); - GDALClose(srcDataset); -} - - -void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QString pszOutFile, GDALResampleAlg eResample) { - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO"); - GDALDataset* pDSrc = (GDALDataset*)GDALOpen(pszSrcFile.toLocal8Bit().constData(), GA_ReadOnly); - if (pDSrc == NULL) { - qDebug() << u8"do not open In Raster file: " << pszSrcFile; - return ; - } - - GDALDataset* pDRef = (GDALDataset*)GDALOpen(RefrasterBPath.toLocal8Bit().constData(), GA_ReadOnly); - if (pDRef == NULL) { - qDebug() << u8"do not open Ref Raster file: " << RefrasterBPath; - return; - } - - QString filesuffer = getFileExtension(pszOutFile).toLower(); - bool isTiff = filesuffer.contains("tif"); - GDALDriver* pDriver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI"); - - if (pDriver == NULL) { - qDebug() << "not open driver"; - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return ; - } - int width = pDSrc->GetRasterXSize(); - int height = pDSrc->GetRasterYSize(); - int nBandCount = pDSrc->GetRasterCount(); - GDALDataType dataType = pDSrc->GetRasterBand(1)->GetRasterDataType(); - - char* pszSrcWKT = NULL; - pszSrcWKT = const_cast(pDSrc->GetProjectionRef()); - - // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7 - if (strlen(pszSrcWKT) <= 0) { - OGRSpatialReference oSRS; - oSRS.importFromEPSG(4326); - // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷 - // oSRS.SetWellKnownGeogCS("WGS84"); - oSRS.exportToWkt(&pszSrcWKT); - } - - char* pdstSrcWKT = NULL; - pdstSrcWKT = const_cast(pDRef->GetProjectionRef()); - - // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7 - if (strlen(pdstSrcWKT) <= 0) - { - OGRSpatialReference oSRS; - oSRS.importFromEPSG(4326); - // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷 - // oSRS.SetWellKnownGeogCS("WGS84"); - oSRS.exportToWkt(&pdstSrcWKT); - } - - - int new_width = pDRef->GetRasterXSize(); - int new_height = pDRef->GetRasterYSize(); - double gt[6] ; - pDRef->GetGeoTransform(gt); - - // GDALDestroyGenImgProjTransformer(hTransformArg); - qDebug() << "create init GDALDataset "; - GDALDataset* pDDst = - pDriver->Create(pszOutFile.toLocal8Bit().constData(), new_width, new_height, nBandCount, dataType, NULL); - if (pDDst == NULL) { - qDebug() << "not create init GDALDataset "; - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALClose((GDALDatasetH)(GDALDatasetH)pDRef); - return ; - } - - pDDst->SetProjection(pdstSrcWKT); - pDDst->SetGeoTransform(gt); - - - qDebug() << "GDALCreateGenImgProjTransformer " << Qt::endl; - void* hTransformArg; - hTransformArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, NULL, pszSrcWKT, - FALSE, 0.0, 1); - qDebug() << "no proj "; - //(没锟斤拷投影锟斤拷影锟斤拷锟斤拷锟斤拷锟斤拷卟锟酵?拷锟?1锟?7) - if (hTransformArg == NULL) { - qDebug() << "hTransformArg create failure"; - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALClose((GDALDatasetH)(GDALDatasetH)pDRef); - return; - } - qDebug() << "has proj "; - double dGeoTrans[6] = { 0 }; - int nNewWidth = 0, nNewHeight = 0; - if (GDALSuggestedWarpOutput((GDALDatasetH)pDSrc, GDALGenImgProjTransform, hTransformArg, - dGeoTrans, &nNewWidth, &nNewHeight) - != CE_None) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALClose((GDALDatasetH)(GDALDatasetH)pDRef); - return ; - } - - - - GDALWarpOptions* psWo = GDALCreateWarpOptions(); - CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // 使用所有可用的CPU核心 - CPLSetConfigOption("GDAL_CACHEMAX", "16000"); // 设置缓存大小为500MB - // psWo->papszWarpOptions = CSLDuplicate(NULL); - psWo->eWorkingDataType = dataType; - - - - psWo->eResampleAlg = eResample; - - psWo->hSrcDS = (GDALDatasetH)pDSrc; - psWo->hDstDS = (GDALDatasetH)pDDst; - qDebug() << "GDALCreateGenImgProjTransformer" ; - psWo->pfnTransformer = GDALGenImgProjTransform; - psWo->pTransformerArg = GDALCreateGenImgProjTransformer( - (GDALDatasetH)pDSrc, pszSrcWKT, (GDALDatasetH)pDDst, pszSrcWKT, FALSE, 0.0, 1); - ; - - qDebug() << "GDALCreateGenImgProjTransformer has created" << Qt::endl; - psWo->nBandCount = nBandCount; - psWo->panSrcBands = (int*)CPLMalloc(nBandCount * sizeof(int)); - psWo->panDstBands = (int*)CPLMalloc(nBandCount * sizeof(int)); - for (int i = 0; i < nBandCount; i++) { - psWo->panSrcBands[i] = i + 1; - psWo->panDstBands[i] = i + 1; - } - - GDALWarpOperation oWo; - if (oWo.Initialize(psWo) != CE_None) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALClose((GDALDatasetH)(GDALDatasetH)pDRef); - return ; - } - qDebug() << "ChunkAndWarpImage:" << new_width << "," << new_height << Qt::endl; - oWo.ChunkAndWarpMulti(0, 0, new_width, new_height); - GDALFlushCache(pDDst); - qDebug() << "ChunkAndWarpImage over" << Qt::endl; - // GDALDestroyGenImgProjTransformer(psWo->pTransformerArg); - // GDALDestroyWarpOptions(psWo); - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALClose((GDALDatasetH)(GDALDatasetH)pDRef); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - return ; -} - - - -void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, QString OutrasterCPath) { - // 注册所有GDAL驱动 - GDALAllRegister(); - - // 打开参考栅格B - GDALDataset* refDS = (GDALDataset*)GDALOpen(RefrasterBPath.toUtf8().constData(), GA_ReadOnly); - if (!refDS) { - qDebug() << "无法打开参考栅格B:" << RefrasterBPath; - return; - } - - // 获取参考栅格的地理变换、投影和尺寸 - double geotransform[6]; - if (refDS->GetGeoTransform(geotransform) != CE_None) { - qDebug() << "获取参考栅格的地理变换失败。"; - GDALClose(refDS); - return; - } - - const char* proj = refDS->GetProjectionRef(); - int cols = refDS->GetRasterXSize(); - int rows = refDS->GetRasterYSize(); - GDALClose(refDS); // 获取信息后关闭参考栅格 - - // 打开输入栅格A - GDALDataset* srcDS = (GDALDataset*)GDALOpen(InrasterAPath.toUtf8().constData(), GA_ReadOnly); - if (!srcDS) { - qDebug() << "无法打开输入栅格A:" << InrasterAPath; - return; - } - - // 获取输入栅格的波段数和数据类型 - int nBands = srcDS->GetRasterCount(); - if (nBands == 0) { - qDebug() << "输入栅格没有波段数据。"; - GDALClose(srcDS); - return; - } - GDALDataType dataType = srcDS->GetRasterBand(1)->GetRasterDataType(); - - // 创建输出栅格C - GDALDriver* driver = GetGDALDriverManager()->GetDriverByName("GTiff"); - if (!driver) { - qDebug() << "无法获取GeoTIFF驱动。"; - GDALClose(srcDS); - return; - } - - GDALDataset* dstDS = driver->Create( - OutrasterCPath.toUtf8().constData(), - cols, - rows, - nBands, - dataType, - nullptr - ); - if (!dstDS) { - qDebug() << "无法创建输出栅格:" << OutrasterCPath; - GDALClose(srcDS); - return; - } - - // 设置输出栅格的地理变换和投影 - dstDS->SetGeoTransform(geotransform); - dstDS->SetProjection(proj); - - // 配置GDAL Warp选项 - GDALWarpOptions* psWO = GDALCreateWarpOptions(); - psWO->hSrcDS = srcDS; - psWO->hDstDS = dstDS; - psWO->nBandCount = nBands; - psWO->panSrcBands = (int*)CPLMalloc(nBands * sizeof(int)); - psWO->panDstBands = (int*)CPLMalloc(nBands * sizeof(int)); - for (int i = 0; i < nBands; ++i) { - psWO->panSrcBands[i] = i + 1; - psWO->panDstBands[i] = i + 1; - } - psWO->eResampleAlg = GRA_NearestNeighbour; // 使用最近邻重采样 - - // 初始化坐标转换器 - psWO->pfnTransformer = GDALGenImgProjTransform; - psWO->pTransformerArg = GDALCreateGenImgProjTransformer( - srcDS, GDALGetProjectionRef(srcDS), - dstDS, GDALGetProjectionRef(dstDS), - FALSE, 0.0, 1 - ); - if (!psWO->pTransformerArg) { - qDebug() << "创建坐标转换器失败。"; - GDALDestroyWarpOptions(psWO); - GDALClose(srcDS); - GDALClose(dstDS); - return; - } - - // 执行Warp操作 - GDALWarpOperation oWarp; - if (oWarp.Initialize(psWO) != CE_None) { - qDebug() << "初始化Warp操作失败。"; - GDALDestroyGenImgProjTransformer(psWO->pTransformerArg); - GDALDestroyWarpOptions(psWO); - GDALClose(srcDS); - GDALClose(dstDS); - return; - } - - CPLErr eErr = oWarp.ChunkAndWarpImage(0, 0, cols, rows); - if (eErr != CE_None) { - qDebug() << "执行Warp操作失败。"; - } - - // 清理资源 - GDALDestroyGenImgProjTransformer(psWO->pTransformerArg); - GDALDestroyWarpOptions(psWO); - GDALClose(srcDS); - GDALClose(dstDS); - - qDebug() << "重采样完成,结果已保存至:" << OutrasterCPath; -} - - -void CreateSARIntensityByLookTable(QString IntensityRasterPath, - QString LookTableRasterPath, - QString SARIntensityPath, - long min_rid, long max_rid, - long min_cid, long max_cid, - std::function processBarShow -) -{ - gdalImage looktableds(LookTableRasterPath); - gdalImage geoIntensity(IntensityRasterPath); - gdalImage SARIntensity= CreategdalImageDouble(SARIntensityPath,max_rid-min_rid,max_cid-min_cid,1); - - long blockYSize = Memory1GB / looktableds.width / 8 * 2; - - Eigen::MatrixXd SARData = SARIntensity.getData(0, 0, SARIntensity.height, SARIntensity.width, 1); - SARData = SARData.array() * 0; - // 分块处理 - for (int yOff = 0; yOff < looktableds.height; yOff += blockYSize) - { - processBarShow(yOff, looktableds.height); - qDebug() << "Process : [" << yOff * 100.0 / looktableds.height << " % ]"; - Eigen::MatrixXd rowData = looktableds.getData(yOff, 0, blockYSize, looktableds.width, 1); - Eigen::MatrixXd colData = looktableds.getData(yOff, 0, blockYSize, looktableds.width, 2); - Eigen::MatrixXd geoData = geoIntensity.getData(yOff, 0, blockYSize, looktableds.width, 1); - - for (long i = 0; i < rowData.rows(); i++) { - for (long j = 0; j < rowData.cols(); j++) { - long r =round( rowData(i,j))-min_rid; - long c = round(colData(i, j))-min_cid; - - if (r >= 0 && r < SARIntensity.height && c >= 0 && c < SARIntensity.width) { - SARData(r, c) = SARData(r, c) + geoData(i, j); - } - } - } - } - SARIntensity.saveImage(SARData, 0, 0, 1); - qDebug() << "Process : [ 100 % ]"; - processBarShow(1000,1000); -} - - -bool saveEigenMatrixXd2Bin(Eigen::MatrixXd data, QString dataStrPath) -{ - - Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3); - - gdalImage img = CreategdalImageDouble(dataStrPath, data.rows(), data.cols(), 1, gt, "", false, true, true); - - img.saveImage(data, 0, 0, 1); - - return true; -} - - - - diff --git a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h b/BaseCommonLibrary/BaseTool/ImageOperatorBase.h deleted file mode 100644 index b16127d..0000000 --- a/BaseCommonLibrary/BaseTool/ImageOperatorBase.h +++ /dev/null @@ -1,626 +0,0 @@ -#pragma once -/** - * 影像数据操作项 - * 所有数据相关的操作,都是基于ENVI的数据格式 - * 影像读写操作时基于 GDAL 库 - * **/ - - - -#ifndef IMAGEOPERATORBASE_H -#define IMAGEOPERATORBASE_H -#include "BaseConstVariable.h" -#include "GeoOperator.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // for CPLMalloc() -#include "LogInfoCls.h" -#include -#include -#include -#include "ShowProessAbstract.h" - - - -enum ProjectStripDelta { - Strip_6, // 6度带 - Strip_3 -}; - -enum CoordinateSystemType { // 坐标系类型 - GeoCoordinateSystem, - ProjectCoordinateSystem, - UNKNOW -}; - -struct PointRaster { // 影像坐标点 - double x; - double y; - double z; -}; - - -struct PointXYZ { - double x, y, z; -}; - -struct PointGeo { - double lon, lat, ati; -}; - -struct PointImage { - double pixel_x, pixel_y; -}; - - - -struct ImageGEOINFO { - int width; - int height; - int bandnum; -}; - - -enum GDALREADARRCOPYMETHOD { - MEMCPYMETHOD, // 直接拷贝 - VARIABLEMETHOD // 变量赋值 - -}; - - - - - - -/// 根据经纬度获取 -/// EPSG代码,根据经纬度返回对应投影坐标系统,其中如果在中华人民共和国境内,默认使用 -/// CGCS2000坐标系统(EPSG 4502 ~ 4512 6度带,EPSG 4534 ~ 4554 3度带),其余地方使用WGS坐标系统, -/// 投影方法 高斯克吕格(国内), 高斯克吕格 -/// \param long 经度 -/// \param lat 纬度 -/// \return 对应投影坐标系统的 EPSG编码,-1 表示计算错误 -long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double lon, double lat, ProjectStripDelta stripState= ProjectStripDelta::Strip_6); - -long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat); - -long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat); - - -QString BASECONSTVARIABLEAPI GetProjectionNameFromEPSG(long epsgCode); - - -long BASECONSTVARIABLEAPI GetEPSGFromRasterFile(QString filepath); - -std::shared_ptr BASECONSTVARIABLEAPI GetCenterPointInRaster(QString filepath); - -CoordinateSystemType BASECONSTVARIABLEAPI getCoordinateSystemTypeByEPSGCode(long EPSGCODE); - - -// 文件打开 // 当指令销毁时,调用GDALClose 销毁类型 -std::shared_ptr BASECONSTVARIABLEAPI OpenDataset(const QString& in_path, GDALAccess rwmode = GA_ReadOnly); -void BASECONSTVARIABLEAPI CloseDataset(GDALDataset* ptr); - -// 数据格式转换 -int BASECONSTVARIABLEAPI TIFF2ENVI(QString in_tiff_path, QString out_envi_path); -int BASECONSTVARIABLEAPI ENVI2TIFF(QString in_envi_path, QString out_tiff_path); - -// 保存影像数据 --直接保存 ENVI 文件 - -int BASECONSTVARIABLEAPI CreateDataset(QString new_file_path, int height, int width, int band_num, double* gt, QString projection, GDALDataType gdal_dtype, bool need_gt); // 创建文件 - -int BASECONSTVARIABLEAPI saveDataset(QString new_file_path, int start_line, int start_cols, int band_ids, int datacols, int datarows, void* databuffer); - -// 根据限制条件估算分块大小 -int BASECONSTVARIABLEAPI block_num_pre_memory(int width, int height, GDALDataType gdal_dtype, double memey_size); - -// 将结果转换为复数 或者 实数 -Eigen::Matrix BASECONSTVARIABLEAPI ReadComplexMatrixData(int start_line, int width, int line_num, std::shared_ptr rasterDataset, GDALDataType gdal_datatype); - -Eigen::Matrix BASECONSTVARIABLEAPI ReadMatrixDoubleData(int start_line, int width, int line_num, std::shared_ptr rasterDataset, GDALDataType gdal_datatype, int band_idx); - -Eigen::MatrixXd BASECONSTVARIABLEAPI getGeoTranslationArray(QString in_path); -ImageGEOINFO BASECONSTVARIABLEAPI getImageINFO(QString in_path); - -GDALDataType BASECONSTVARIABLEAPI getGDALDataType(QString fileptah); - - -struct RasterExtend { - double min_x; - double min_y; - double max_x; - double max_y; -}; - - - - - -/// -/// gdalImage图像操作类 -/// - -class BASECONSTVARIABLEAPI gdalImage -{ - -public: // 方法 - gdalImage(); - gdalImage(const QString& raster_path); - ~gdalImage(); - virtual void setHeight(int); - virtual void setWidth(int); - virtual void setTranslationMatrix(Eigen::MatrixXd gt); - virtual void setData(Eigen::MatrixXd, int data_band_ids = 1); - virtual Eigen::MatrixXd getData(int start_row, int start_col, int rows_count, int cols_count, int band_ids); - virtual Eigen::MatrixXf getDataf(int start_row, int start_col, int rows_count, int cols_count, int band_ids); - virtual Eigen::MatrixXi getDatai(int start_row, int start_col, int rows_count, int cols_count, int band_ids); - virtual ErrorCode getData(double* data, int start_row, int start_col, int rows_count, int cols_count, int band_ids); - virtual ErrorCode getData(long* data, int start_row, int start_col, int rows_count, int cols_count, int band_ids); - virtual Eigen::MatrixXd getGeoTranslation(); - virtual GDALDataType getDataType(); - virtual void saveImage(Eigen::MatrixXd, int start_row, int start_col, int band_ids); - virtual void saveImage(Eigen::MatrixXf, int start_row, int start_col, int band_ids); - virtual void saveImage(Eigen::MatrixXi, int start_row, int start_col, int band_ids); - virtual void saveImage(std::shared_ptr, int start_row, int start_col,int rowcount,int colcount, int band_ids); - virtual void saveImage(std::shared_ptr, int start_row, int start_col, int rowcount, int colcount, int band_ids); - virtual void saveImage(std::shared_ptr, int start_row, int start_col, int rowcount, int colcount, int band_ids); - - virtual void saveImage(); - virtual void setNoDataValue(double nodatavalue, int band_ids); - virtual void setNoDataValuei(int nodatavalue, int band_ids); - virtual double getNoDataValue(int band_ids); - virtual int getNoDataValuei(int band_ids); - virtual int InitInv_gt(); - virtual Landpoint getRow_Col(double lon, double lat); - virtual Landpoint getLandPoint(double i, double j, double ati); - - virtual void getLandPoint(double i, double j, double ati, Landpoint& Lp); - - virtual double mean(int bandids = 1); - double BandmaxValue(int bandids = 1); - double BandminValue(int bandids = 1); - virtual GDALRPCInfo getRPC(); - virtual Eigen::MatrixXd getLandPoint(Eigen::MatrixXd points); - - virtual Eigen::MatrixXd getHist(int bandids); - - virtual RasterExtend getExtend(); - - - - - -public: - QString img_path; // 图像文件 - int height; // 高 - int width; // 宽 - int band_num;// 波段数 - int start_row;// - int start_col;// - int data_band_ids; - Eigen::MatrixXd gt; // 变换矩阵 - Eigen::MatrixXd inv_gt; // 逆变换矩阵 - Eigen::MatrixXd data; - QString projection; -}; - - - -/// -/// gdalImage图像操作类 -/// -class BASECONSTVARIABLEAPI gdalImageComplex :public gdalImage -{ - -public: // 方法 - gdalImageComplex(const QString& raster_path); - ~gdalImageComplex(); - void setData(Eigen::MatrixXcd); - void saveImage(Eigen::MatrixXcd data, int start_row, int start_col, int band_ids); - void saveImage(std::shared_ptr> data, long start_row, long start_col, long rowCount, long colCount, int band_ids); - void saveImage(std::complex* data, long start_row, long start_col, long rowcount, long colcount, int banids); - - Eigen::MatrixXcd getDataComplex(int start_row, int start_col, int rows_count, int cols_count, int band_ids); - std::shared_ptr> getDataComplexSharePtr(int start_row, int start_col, int rows_count, int cols_count, int band_ids); - - void saveComplexImage();//override; - void savePreViewImage(); -public: - Eigen::MatrixXcd data; -}; - - -bool BASECONSTVARIABLEAPI CopyProjectTransformMatrixFromRasterAToRasterB(QString RasterAPath, QString RasterBPath); - - -// 创建影像 -gdalImage BASECONSTVARIABLEAPI CreategdalImageDouble(QString& img_path, int height, int width, int band_num, bool overwrite = false, bool isEnvi = false); -gdalImage BASECONSTVARIABLEAPI CreategdalImageFloat(QString& img_path, int height, int width, int band_num, bool overwrite = false, bool isEnvi = false); -gdalImage BASECONSTVARIABLEAPI CreategdalImageDouble(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt = true, bool overwrite = false, bool isEnvi = false); -gdalImage BASECONSTVARIABLEAPI CreategdalImage(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection,bool need_gt = true, bool overwrite = false, bool isEnvi = false, GDALDataType datetype = GDT_Float32); -gdalImage BASECONSTVARIABLEAPI CreategdalImage(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, long espgcode, GDALDataType eType = GDT_Float32, bool need_gt = true, bool overwrite = false, bool isENVI = false); - -gdalImageComplex BASECONSTVARIABLEAPI CreategdalImageComplex(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt = true, bool overwrite = false); -gdalImageComplex BASECONSTVARIABLEAPI CreategdalImageComplexNoProj(const QString& img_path, int height, int width, int band_num, bool overwrite = true); - -gdalImageComplex BASECONSTVARIABLEAPI CreateEchoComplex(const QString& img_path, int height, int width, int band_num); - -ErrorCode BASECONSTVARIABLEAPI DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QString demsloperPath); - -int BASECONSTVARIABLEAPI ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int new_width, int new_height, GDALResampleAlg eResample); - -void BASECONSTVARIABLEAPI resampleRaster(const char* inputRaster, const char* outputRaster, double targetPixelSizeX, double targetPixelSizeY); - -void BASECONSTVARIABLEAPI cropRasterByLatLon(const char* inputFile, const char* outputFile, double minLon, double maxLon, double minLat, double maxLat); - -int BASECONSTVARIABLEAPI ResampleGDALs(const char* pszSrcFile, int band_ids, GDALRIOResampleAlg eResample = GRIORA_Bilinear); - -void BASECONSTVARIABLEAPI transformRaster(const char* inputFile, const char* outputFile, int sourceEPSG, int targetEPSG); - -ErrorCode BASECONSTVARIABLEAPI transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG, Point2& p); - -int BASECONSTVARIABLEAPI alignRaster(QString inputPath, QString referencePath, QString outputPath, GDALResampleAlg eResample); - - -void BASECONSTVARIABLEAPI ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QString pszOutFile, GDALResampleAlg eResample); - -//--------------------- 保存文博 ------------------------------- - -int BASECONSTVARIABLEAPI saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path); - -//---------------------------------------------------- - -void BASECONSTVARIABLEAPI clipRaster(QString inRasterPath, QString outRasterPath, long minRow, long maxRow, long minCol, long maxCol); - -// 坐标系转换 -void BASECONSTVARIABLEAPI ConvertCoordinateSystem(QString inRasterPath, QString outRasterPath, long outepsgcode); - -//--------------------- 图像合并流程 ------------------------------ -enum MERGEMODE -{ - MERGE_GEOCODING, -}; - -void BASECONSTVARIABLEAPI MergeTiffs(QList inputFiles, QString outputFile); - -ErrorCode BASECONSTVARIABLEAPI MergeRasterProcess(QVector filepath, QString outfileptah, QString mainString, MERGEMODE mergecode = MERGEMODE::MERGE_GEOCODING, bool isENVI = false, ShowProessAbstract* dia = nullptr); - - -ErrorCode BASECONSTVARIABLEAPI MergeRasterInGeoCoding(QVector inimgs, gdalImage resultimg, gdalImage maskimg, ShowProessAbstract* dia = nullptr); - - -// 保存矩阵转换为envi文件,默认数据格式为double -bool BASECONSTVARIABLEAPI saveEigenMatrixXd2Bin(Eigen::MatrixXd data, QString dataStrPath); - - -// 测试 -void BASECONSTVARIABLEAPI testOutAntPatternTrans(QString antpatternfilename, double* antPatternArr, double starttheta, double deltetheta, double startphi, double deltaphi, long thetanum, long phinum); -void BASECONSTVARIABLEAPI testOutAmpArr(QString filename, float* amp, long rowcount, long colcount); -void BASECONSTVARIABLEAPI testOutAmpArr(QString filename, double* amp, long rowcount, long colcount); -void BASECONSTVARIABLEAPI testOutClsArr(QString filename, long* amp, long rowcount, long colcount); -void BASECONSTVARIABLEAPI testOutComplexDoubleArr(QString filename, std::complex* data, long rowcount, long colcount); -void BASECONSTVARIABLEAPI testOutDataArr(QString filename, double* data, long rowcount, long colcount); -void BASECONSTVARIABLEAPI testOutDataArr(QString filename, float* data, long rowcount, long colcount); -void BASECONSTVARIABLEAPI testOutDataArr(QString filename, long* data, long rowcount, long colcount); - - - -void BASECONSTVARIABLEAPI CreateSARIntensityByLookTable(QString IntensityRasterPath, QString LookTableRasterPath, QString SARIntensityPath, long min_rid, long max_rid, long min_cid, long max_cid, std::function processBarShow = {}); - -bool BASECONSTVARIABLEAPI ConvertVrtToEnvi(QString vrtPath, QString outPath); - - - - -void BASECONSTVARIABLEAPI MultiLookRaster(QString inRasterPath, QString outRasterPath, long looklineNumrow, long looklineNumCol); -ErrorCode BASECONSTVARIABLEAPI Complex2PhaseRaster(QString inComplexPath, QString outRasterPath); -ErrorCode BASECONSTVARIABLEAPI Complex2dBRaster(QString inComplexPath, QString outRasterPath); -ErrorCode BASECONSTVARIABLEAPI Complex2AmpRaster(QString inComplexPath, QString outRasterPath); -ErrorCode BASECONSTVARIABLEAPI amp2dBRaster(QString inPath, QString outRasterPath); - - -ErrorCode BASECONSTVARIABLEAPI ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy); - - -void BASECONSTVARIABLEAPI CloseAllGDALRaster(); - - - -//--------------------- 图像文件读写 ------------------------------ - - - -template -inline std::shared_ptr readDataArr(gdalImage& imgds, long start_row, long start_col, long& rows_count, long& cols_count, int band_ids, GDALREADARRCOPYMETHOD method) -{ - std::shared_ptr result = nullptr; - - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(imgds.img_path.toUtf8().constData(), GA_ReadOnly)); // 锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷 - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* demBand = rasterDataset->GetRasterBand(band_ids); - - rows_count = start_row + rows_count <= imgds.height ? rows_count : imgds.height - start_row; - cols_count = start_col + cols_count <= imgds.width ? cols_count : imgds.width - start_col; - - //Eigen::MatrixXd datamatrix(rows_count, cols_count); - - if (gdal_datatype == GDT_Byte) { - char* temp = new char[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, rows_count, gdal_datatype, 0, 0); - result = std::shared_ptr(new T[rows_count * cols_count], delArrPtr); - if (method == GDALREADARRCOPYMETHOD::MEMCPYMETHOD) { - std::memcpy(result.get(), temp, rows_count * cols_count); - } - else if (method == GDALREADARRCOPYMETHOD::VARIABLEMETHOD) { - long count = rows_count * cols_count; - for (long i = 0; i < count; i++) { - result.get()[i] = T(temp[i]); - } - } - - delete[] temp; - } - else if (gdal_datatype == GDT_UInt16) { - unsigned short* temp = new unsigned short[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, rows_count, gdal_datatype, 0, 0); - result = std::shared_ptr(new T[rows_count * cols_count], delArrPtr); - if (method == GDALREADARRCOPYMETHOD::MEMCPYMETHOD) { - std::memcpy(result.get(), temp, rows_count * cols_count); - } - else if (method == GDALREADARRCOPYMETHOD::VARIABLEMETHOD) { - long count = rows_count * cols_count; - for (long i = 0; i < count; i++) { - result.get()[i] = T(temp[i]); - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_Int16) { - short* temp = new short[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, rows_count, gdal_datatype, 0, 0); - result = std::shared_ptr(new T[rows_count * cols_count], delArrPtr); - if (method == GDALREADARRCOPYMETHOD::MEMCPYMETHOD) { - std::memcpy(result.get(), temp, rows_count * cols_count); - } - else if (method == GDALREADARRCOPYMETHOD::VARIABLEMETHOD) { - long count = rows_count * cols_count; - for (long i = 0; i < count; i++) { - result.get()[i] = T(temp[i]); - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_UInt32) { - unsigned int* temp = new unsigned int[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, rows_count, gdal_datatype, 0, 0); - result = std::shared_ptr(new T[rows_count * cols_count], delArrPtr); - if (method == GDALREADARRCOPYMETHOD::MEMCPYMETHOD) { - std::memcpy(result.get(), temp, rows_count * cols_count); - } - else if (method == GDALREADARRCOPYMETHOD::VARIABLEMETHOD) { - long count = rows_count * cols_count; - for (long i = 0; i < count; i++) { - result.get()[i] = T(temp[i]); - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_Int32) { - int* temp = new int[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, rows_count, gdal_datatype, 0, 0); - result = std::shared_ptr(new T[rows_count * cols_count], delArrPtr); - if (method == GDALREADARRCOPYMETHOD::MEMCPYMETHOD) { - std::memcpy(result.get(), temp, rows_count * cols_count); - } - else if (method == GDALREADARRCOPYMETHOD::VARIABLEMETHOD) { - long count = rows_count * cols_count; - for (long i = 0; i < count; i++) { - result.get()[i] = T(temp[i]); - } - } - delete[] temp; - } - // else if (gdal_datatype == GDT_UInt64) { - // unsigned long* temp = new unsigned long[rows_count * cols_count]; - // demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - //rows_count, gdal_datatype, 0, 0); for (int i = 0; i < rows_count; i++) { for (int j = 0; j < - //cols_count; j++) { datamatrix(i, j) = temp[i * cols_count + j]; - // } - // } - // delete[] temp; - // } - // else if (gdal_datatype == GDT_Int64) { - // long* temp = new long[rows_count * cols_count]; - // demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - //rows_count, gdal_datatype, 0, 0); for (int i = 0; i < rows_count; i++) { for (int j = 0; j < - //cols_count; j++) { datamatrix(i, j) = temp[i * cols_count + j]; - // } - // } - // delete[] temp; - // } - else if (gdal_datatype == GDT_Float32) { - float* temp = new float[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, rows_count, gdal_datatype, 0, 0); - - result = std::shared_ptr(new T[rows_count * cols_count], delArrPtr); - if (method == GDALREADARRCOPYMETHOD::MEMCPYMETHOD) { - std::memcpy(result.get(), temp, rows_count * cols_count); - } - else if (method == GDALREADARRCOPYMETHOD::VARIABLEMETHOD) { - long count = rows_count * cols_count; - for (long i = 0; i < count; i++) { - result.get()[i] = T(temp[i]); - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_Float64) { - double* temp = new double[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, rows_count, gdal_datatype, 0, 0); - - result = std::shared_ptr(new T[rows_count * cols_count], delArrPtr); - if (method == GDALREADARRCOPYMETHOD::MEMCPYMETHOD) { - std::memcpy(result.get(), temp, rows_count * cols_count); - } - else if (method == GDALREADARRCOPYMETHOD::VARIABLEMETHOD) { - long count = rows_count * cols_count; - for (long i = 0; i < count; i++) { - result.get()[i] = T(temp[i]); - } - } - delete[] temp; - } - //else if (gdal_datatype == GDT_CFloat32) { - // if (std::is_same>::value || std::is_same>::value) { - // float* temp = new float[rows_count * cols_count * 2]; - // demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, rows_count, gdal_datatype, 0, 0); - - // result = std::shared_ptr(new T[rows_count * cols_count], delArrPtr); - // if (method == GDALREADARRCOPYMETHOD::MEMCPYMETHOD) { - // std::memcpy(result.get(), temp, rows_count * cols_count); - // } - // else if (method == GDALREADARRCOPYMETHOD::VARIABLEMETHOD) { - // long count = rows_count * cols_count; - // for (long i = 0; i < count; i++) { - // result.get()[i] = T(temp[i * 2], - // temp[i * 2 + 1]); - // } - // } - // delete[] temp; - // } - // else { - // result = nullptr; - // } - //} - //else if (gdal_datatype == GDT_CFloat64 ) { - // if (std::is_same>::value || std::is_same>::value) { - // double* temp = new double[rows_count * cols_count * 2]; - // demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, rows_count, gdal_datatype, 0, 0); - - // result = std::shared_ptr(new T[rows_count * cols_count], delArrPtr); - // if (method == GDALREADARRCOPYMETHOD::MEMCPYMETHOD) { - // std::memcpy(result.get(), temp, rows_count * cols_count); - // } - // else if (method == GDALREADARRCOPYMETHOD::VARIABLEMETHOD) { - // long count = rows_count * cols_count; - // for (long i = 0; i < count; i++) { - // result.get()[i] = T(temp[i * 2], - // temp[i * 2 + 1]); - // } - // } - // delete[] temp; - // } - // else { - // result = nullptr; - // } - //} - else { - } - GDALClose((GDALDatasetH)rasterDataset); - omp_unset_lock(&lock); // 锟酵放伙拷斤拷 - omp_destroy_lock(&lock); // 劫伙拷斤拷 - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - return result; -}; - -template -inline std::shared_ptr readDataArrComplex(gdalImageComplex& imgds, long start_row, long start_col, long& rows_count, long& cols_count, int band_ids, GDALREADARRCOPYMETHOD method) -{ - std::shared_ptr result = nullptr; - - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(imgds.img_path.toUtf8().constData(), GA_ReadOnly)); // 锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷 - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* demBand = rasterDataset->GetRasterBand(band_ids); - - rows_count = start_row + rows_count <= imgds.height ? rows_count : imgds.height - start_row; - cols_count = start_col + cols_count <= imgds.width ? cols_count : imgds.width - start_col; - - //Eigen::MatrixXd datamatrix(rows_count, cols_count); - - if (gdal_datatype == GDT_CFloat32) { - if (std::is_same>::value || std::is_same>::value) { - float* temp = new float[rows_count * cols_count * 2]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, rows_count, gdal_datatype, 0, 0); - - result = std::shared_ptr(new T[rows_count * cols_count], delArrPtr); - if (method == GDALREADARRCOPYMETHOD::MEMCPYMETHOD) { - std::memcpy(result.get(), temp, rows_count * cols_count); - } - else if (method == GDALREADARRCOPYMETHOD::VARIABLEMETHOD) { - long count = rows_count * cols_count; - for (long i = 0; i < count; i++) { - result.get()[i] = T(temp[i * 2], - temp[i * 2 + 1]); - } - } - delete[] temp; - } - else { - result = nullptr; - } - } - else if (gdal_datatype == GDT_CFloat64) { - if (std::is_same>::value || std::is_same>::value) { - double* temp = new double[rows_count * cols_count * 2]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, rows_count, gdal_datatype, 0, 0); - - result = std::shared_ptr(new T[rows_count * cols_count], delArrPtr); - if (method == GDALREADARRCOPYMETHOD::MEMCPYMETHOD) { - std::memcpy(result.get(), temp, rows_count * cols_count); - } - else if (method == GDALREADARRCOPYMETHOD::VARIABLEMETHOD) { - long count = rows_count * cols_count; - for (long i = 0; i < count; i++) { - result.get()[i] = T(temp[i * 2], - temp[i * 2 + 1]); - } - } - delete[] temp; - } - else { - result = nullptr; - } - } - else { - } - GDALClose((GDALDatasetH)rasterDataset); - omp_unset_lock(&lock); // 锟酵放伙拷斤拷 - omp_destroy_lock(&lock); // 劫伙拷斤拷 - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - return result; -}; - - - - -//--------------------- 图像分块 ------------------------------ - - - - - - - -#endif - diff --git a/BaseCommonLibrary/BaseTool/LogInfoCls.cpp b/BaseCommonLibrary/BaseTool/LogInfoCls.cpp deleted file mode 100644 index a569c7e..0000000 --- a/BaseCommonLibrary/BaseTool/LogInfoCls.cpp +++ /dev/null @@ -1,233 +0,0 @@ -#include "stdafx.h" -#include "LogInfoCls.h" - -std::string errorCode2errInfo(ErrorCode e) -{ - switch (e) - { - _CASE_STR(SUCCESS); - _CASE_STR(VIRTUALABSTRACT); - _CASE_STR(FAIL); - _CASE_STR(FILENOFOUND); - _CASE_STR(OrbitNodeNotEnough); - _CASE_STR(XYDataPointNotEqual); - _CASE_STR(FILEOPENFAIL ); - _CASE_STR(XMLPARSEFAIL ); - _CASE_STR(XMLNOTFOUNDElEMENT ); - _CASE_STR(FILEPATHISEMPTY); - _CASE_STR(FOLDER_NOT_EXIST); - _CASE_STR(FILE_NOT_EXIST); - _CASE_STR(FIND_ID_ERROR); - _CASE_STR(INSERT_ID_ERROR); - _CASE_STR(EPSGCODE_NOTSAME); - _CASE_STR(EPSGCODE_NOTSUPPORT); - _CASE_STR(RASTERBAND_NOTEQUAL); - _CASE_STR(RASTER_DATETYPE_NOTSAME); - //GSL 1xx - _CASE_STR(Error_GSL_FAILURE ); - _CASE_STR(Error_GSL_CONTINUE ); - _CASE_STR(Error_GSL_EDOM ); - _CASE_STR(Error_GSL_ERANGE ); - _CASE_STR(Error_GSL_EFAULT ); - _CASE_STR(Error_GSL_EINVAL ); - _CASE_STR(Error_GSL_EFAILED ); - _CASE_STR(Error_GSL_EFACTOR ); - _CASE_STR(Error_GSL_ESANITY ); - _CASE_STR(Error_GSL_ENOMEM ); - _CASE_STR(Error_GSL_EBADFUNC ); - _CASE_STR(Error_GSL_ERUNAWAY ); - _CASE_STR(Error_GSL_EMAXITER ); - _CASE_STR(Error_GSL_EZERODIV ); - _CASE_STR(Error_GSL_EBADTOL ); - _CASE_STR(Error_GSL_ETOL ); - _CASE_STR(Error_GSL_EUNDRFLW ); - _CASE_STR(Error_GSL_EOVRFLW ); - _CASE_STR(Error_GSL_ELOSS ); - _CASE_STR(Error_GSL_EROUND ); - _CASE_STR(Error_GSL_EBADLEN ); - _CASE_STR(Error_GSL_ENOTSQR ); - _CASE_STR(Error_GSL_ESING ); - _CASE_STR(Error_GSL_EDIVERGE ); - _CASE_STR(Error_GSL_EUNSUP ); - _CASE_STR(Error_GSL_EUNIMPL ); - _CASE_STR(Error_GSL_ECACHE ); - _CASE_STR(Error_GSL_ETABLE ); - _CASE_STR(Error_GSL_ENOPROG ); - _CASE_STR(Error_GSL_ENOPROGJ ); - _CASE_STR(Error_GSL_ETOLF ); - _CASE_STR(Error_GSL_ETOLX ); - _CASE_STR(Error_GSL_ETOLG ); - _CASE_STR(Error_GSL_EOF ); - // RFPC - _CASE_STR(RFPC_PARAMSISEMPTY); - _CASE_STR(ECHO_L0DATA_NOTOPEN); - _CASE_STR(ECHO_L0DATA_ROW_COL_NOEQUAL); - _CASE_STR(ECHO_L0DATA_PRFIDXOUTRANGE); - _CASE_STR(ECHO_L0DATA_GPSFILEFORMATERROR); - _CASE_STR(ECHO_L0DATA_ECHOFILEFORMATERROR); - _CASE_STR(ECHO_L0DATA_ECHOFILENOTOPEN); - _CASE_STR(ECHO_L0DATA_GPSFILEFNOTOPEN); - _CASE_STR(ECHO_L0DATA_XMLFILENOTOPEN); - _CASE_STR(OUTOFRANGE); - _CASE_STR(ECHO_L0DATA_XMLNAMEERROR); - // - _CASE_STR(TBP_L0OPENFAIL); - - // - _CASE_STR(IMAGE_L1DATA_XMLNAMEERROR); - _CASE_STR(IMAGE_L1DATA_XMLNAMEOPENERROR); - - - default: - break; - } - return "UNKNOW_EVENT!"; -} - -ErrorCode GSLState2ErrorCode(int gslState) -{ - - switch (gslState) - { - case 0: - return ErrorCode::SUCCESS; - break; - case -1: - return ErrorCode::Error_GSL_FAILURE; - break; - case -2: - return ErrorCode::Error_GSL_CONTINUE; - break; - case 1: - return ErrorCode::Error_GSL_EDOM; // sqrt(-1) - break; - - case 2: - return ErrorCode::Error_GSL_ERANGE; // Χ exp(1e100) - break; - - case 3: - return ErrorCode::Error_GSL_EFAULT; // Чָ - break; - - case 4: - return ErrorCode::Error_GSL_EINVAL; // ûṩЧ - break; - - case 5: - return ErrorCode::Error_GSL_EFAILED; // ͨʧ - break; - - case 6: - return ErrorCode::Error_GSL_EFACTOR; // ӷֽʧ - break; - - case 7: - return ErrorCode::Error_GSL_ESANITY; // ǼʧܣͨӦ÷ - break; - - case 8: - return ErrorCode::Error_GSL_ENOMEM; // ڴʧ - break; - - case 9: - return ErrorCode::Error_GSL_EBADFUNC; // ûṩĺ - break; - - case 10: - return ErrorCode::Error_GSL_ERUNAWAY; // ʧ - break; - - case 11: - return ErrorCode::Error_GSL_EMAXITER; // - break; - - case 12: - return ErrorCode::Error_GSL_EZERODIV; // Խ - break; - - case 13: - return ErrorCode::Error_GSL_EBADTOL; // û̶ָЧ - break; - - case 14: - return ErrorCode::Error_GSL_ETOL; // δܴﵽ̶ָ - break; - - case 15: - return ErrorCode::Error_GSL_EUNDRFLW; // - break; - - case 16: - return ErrorCode::Error_GSL_EOVRFLW; // - break; - - case 17: - return ErrorCode::Error_GSL_ELOSS; // ʧ - break; - - case 18: - return ErrorCode::Error_GSL_EROUND; // ʧ - break; - - case 19: - return ErrorCode::Error_GSL_EBADLEN; // Ȳƥ - break; - - case 20: - return ErrorCode::Error_GSL_ENOTSQR; // Ƿ - break; - - case 21: - return ErrorCode::Error_GSL_ESING; // ⵽Ե - break; - - case 22: - return ErrorCode::Error_GSL_EDIVERGE; // ֻɢ - break; - - case 23: - return ErrorCode::Error_GSL_EUNSUP; // ԲӲ֧ - break; - - case 24: - return ErrorCode::Error_GSL_EUNIMPL; // δʵ - break; - - case 25: - return ErrorCode::Error_GSL_ECACHE; // - break; - - case 26: - return ErrorCode::Error_GSL_ETABLE; // - break; - - case 27: - return ErrorCode::Error_GSL_ENOPROG; // δܳȡýչ - break; - - case 28: - return ErrorCode::Error_GSL_ENOPROGJ; // ſɱδܸƽ - break; - - case 29: - return ErrorCode::Error_GSL_ETOLF; // ޷ﵽ F ̶ָ - break; - - case 30: - return ErrorCode::Error_GSL_ETOLX; // ޷ﵽ X ̶ָ - break; - - case 31: - return ErrorCode::Error_GSL_ETOLG; // ޷ﵽݶȵ̶ָ - break; - - case 32: - return ErrorCode::Error_GSL_EOF; // ļ - break; - - default: - return ErrorCode::Error_GSL_FAILURE; // δ֪󣬷һʧ - break; - } -} diff --git a/BaseCommonLibrary/BaseTool/LogInfoCls.h b/BaseCommonLibrary/BaseTool/LogInfoCls.h deleted file mode 100644 index 80f074d..0000000 --- a/BaseCommonLibrary/BaseTool/LogInfoCls.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once -/*****************************************************************//** - * \file LogInfoCls.h - * \brief ö࣬ԼشϢ - * - * \author - * \date October 2024 - *********************************************************************/ -#include "BaseConstVariable.h" -#include - -// 任 -#define _CASE_STR(x) case x : return #x; break; - - -enum ErrorCode { - SUCCESS = -1,// ִгɹ - VIRTUALABSTRACT = -2,// virtual abstract function not implement - FAIL=0, - FILENOFOUND = 1, - OrbitNodeNotEnough = 2, - XYDataPointNotEqual = 3, - FILEOPENFAIL = 4, - XMLPARSEFAIL = 5, - XMLNOTFOUNDElEMENT = 6, - FILEPATHISEMPTY = 7, - FOLDER_NOT_EXIST = 8, - FILE_NOT_EXIST = 9, - FIND_ID_ERROR = 10, - INSERT_ID_ERROR = 11, - EPSGCODE_NOTSAME = 12, - EPSGCODE_NOTSUPPORT = 13, - RASTERBAND_NOTEQUAL = 14, - RASTER_DATETYPE_NOTSAME = 15, - //GSL 1xx - Error_GSL_FAILURE = -101, - Error_GSL_CONTINUE = -102, /* iteration has not converged */ - Error_GSL_EDOM = 101, /* input domain error, e.g sqrt(-1) */ - Error_GSL_ERANGE = 102, /* output range error, e.g. exp(1e100) */ - Error_GSL_EFAULT = 103, /* invalid pointer */ - Error_GSL_EINVAL = 104, /* invalid argument supplied by user */ - Error_GSL_EFAILED = 105, /* generic failure */ - Error_GSL_EFACTOR = 106, /* factorization failed */ - Error_GSL_ESANITY = 107, /* sanity check failed - shouldn't happen */ - Error_GSL_ENOMEM = 108, /* malloc failed */ - Error_GSL_EBADFUNC = 109, /* problem with user-supplied function */ - Error_GSL_ERUNAWAY = 110, /* iterative process is out of control */ - Error_GSL_EMAXITER = 111, /* exceeded max number of iterations */ - Error_GSL_EZERODIV = 112, /* tried to divide by zero */ - Error_GSL_EBADTOL = 113, /* user specified an invalid tolerance */ - Error_GSL_ETOL = 114, /* failed to reach the specified tolerance */ - Error_GSL_EUNDRFLW = 115, /* underflow */ - Error_GSL_EOVRFLW = 116, /* overflow */ - Error_GSL_ELOSS = 117, /* loss of accuracy */ - Error_GSL_EROUND = 118, /* failed because of roundoff error */ - Error_GSL_EBADLEN = 119, /* matrix, vector lengths are not conformant */ - Error_GSL_ENOTSQR = 120, /* matrix not square */ - Error_GSL_ESING = 121, /* apparent singularity detected */ - Error_GSL_EDIVERGE = 122, /* integral or series is divergent */ - Error_GSL_EUNSUP = 123, /* requested feature is not supported by the hardware */ - Error_GSL_EUNIMPL = 124, /* requested feature not (yet) implemented */ - Error_GSL_ECACHE = 125, /* cache limit exceeded */ - Error_GSL_ETABLE = 126, /* table limit exceeded */ - Error_GSL_ENOPROG = 127, /* iteration is not making progress towards solution */ - Error_GSL_ENOPROGJ = 128, /* jacobian evaluations are not improving the solution */ - Error_GSL_ETOLF = 129, /* cannot reach the specified tolerance in F */ - Error_GSL_ETOLX = 130, /* cannot reach the specified tolerance in X */ - Error_GSL_ETOLG = 131, /* cannot reach the specified tolerance in gradient */ - Error_GSL_EOF = 132, /* end of file */ - - // RFPC - RFPC_PARAMSISEMPTY = 201, - // L0 - ECHO_L0DATA_NOTOPEN = 202, - ECHO_L0DATA_ROW_COL_NOEQUAL = 203, // л - ECHO_L0DATA_PRFIDXOUTRANGE = 204, // PRF Χ - ECHO_L0DATA_GPSFILEFORMATERROR = 205, // GPSļ - ECHO_L0DATA_ECHOFILEFORMATERROR = 206, // زļʽ - ECHO_L0DATA_ECHOFILENOTOPEN = 207, // زļ򿪴 - ECHO_L0DATA_GPSFILEFNOTOPEN = 208, // GPSļ򿪴 - ECHO_L0DATA_XMLFILENOTOPEN = 209, // xmlļ򿪴 - OUTOFRANGE = 210, // Χ - ECHO_L0DATA_XMLNAMEERROR = 211, // Χ - // BP - TBP_L0OPENFAIL = 301, // 0ļ򿪴 - - // L1ͼ - IMAGE_L1DATA_XMLNAMEERROR = 401, - IMAGE_L1DATA_XMLNAMEOPENERROR = 402, - IMAGE_L1DATA_XMLNAMEPARASEERROR = 403, - -}; - - - -std::string BASECONSTVARIABLEAPI errorCode2errInfo(ErrorCode code); - - -ErrorCode BASECONSTVARIABLEAPI GSLState2ErrorCode(int gslState); - - - diff --git a/BaseCommonLibrary/BaseTool/MergeRasterOperator.cpp b/BaseCommonLibrary/BaseTool/MergeRasterOperator.cpp deleted file mode 100644 index f8144e7..0000000 --- a/BaseCommonLibrary/BaseTool/MergeRasterOperator.cpp +++ /dev/null @@ -1,488 +0,0 @@ -#include "stdafx.h" -#include "ImageOperatorBase.h" -#include "BaseTool.h" -#include "GeoOperator.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "FileOperator.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include // OGRSpatialReference ڿռοת -#include // GDALWarp - -ErrorCode MergeRasterProcess(QVector filepaths, QString outfileptah, QString mainString, MERGEMODE mergecode, bool isENVI, ShowProessAbstract* dia) -{ - // - if (!isExists(mainString)) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::FILENOFOUND)) << "\t" << mainString; - return ErrorCode::FILENOFOUND; - } - else {} - gdalImage mainimg(mainString); - QVector imgdslist(filepaths.count()); - for (long i = 0; i < filepaths.count(); i++) { - if (!isExists(filepaths[i])) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::FILENOFOUND)) << "\t" << filepaths[i]; - return ErrorCode::FILENOFOUND; - } - else { - imgdslist[i] = gdalImage(filepaths[i]); - if (imgdslist[i].band_num != mainimg.band_num) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::RASTERBAND_NOTEQUAL)) << "\t" << imgdslist[i].band_num << " != " << mainimg.band_num; - return ErrorCode::RASTERBAND_NOTEQUAL; - } - } - } - - // ϵǷͳһ - long EPSGCode = GetEPSGFromRasterFile(mainString); - long tempCode = 0; - for (long i = 0; i < filepaths.count(); i++) { - tempCode = GetEPSGFromRasterFile(filepaths[i]); - if (EPSGCode != tempCode) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::EPSGCODE_NOTSAME)) << "\t" << EPSGCode << "!=" << tempCode; - return ErrorCode::EPSGCODE_NOTSAME; - } - } - - // ӰǷͳһ - GDALDataType mainType = mainimg.getDataType(); - for (long i = 0; i < imgdslist.count(); i++) { - if (mainType != imgdslist[i].getDataType()) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::RASTER_DATETYPE_NOTSAME)) << "\t" << mainType << "!=" << imgdslist[i].getDataType(); - return ErrorCode::RASTER_DATETYPE_NOTSAME; - } - } - - Eigen::MatrixXd maingt = mainimg.getGeoTranslation(); - Eigen::MatrixXd rgt = Eigen::MatrixXd::Zero(2, 3); - RasterExtend mainExtend = mainimg.getExtend(); - rgt(0, 1) = (mainExtend.max_x - mainExtend.min_x) / (mainimg.width - 1); //dx - rgt(1, 2) = -1 * std::abs(((mainExtend.max_y - mainExtend.min_y) / (mainimg.height - 1)));//dy - QVector extendlist(imgdslist.count()); - for (long i = 0; i < imgdslist.count(); i++) { - extendlist[i] = imgdslist[i].getExtend(); - mainExtend.min_x = mainExtend.min_x < extendlist[i].min_x ? mainExtend.min_x : extendlist[i].min_x; - mainExtend.max_x = mainExtend.max_x > extendlist[i].max_x ? mainExtend.max_x : extendlist[i].max_x; - mainExtend.min_y = mainExtend.min_y < extendlist[i].min_y ? mainExtend.min_y : extendlist[i].min_y; - mainExtend.max_y = mainExtend.max_y > extendlist[i].max_y ? mainExtend.max_y : extendlist[i].max_y; - } - - rgt(0, 0) = mainExtend.min_x; - rgt(1, 0) = mainExtend.max_y; - - // - - long width = std::ceil((mainExtend.max_x - mainExtend.min_x) / rgt(0, 1) + 1); - long height = std::ceil(std::abs((mainExtend.min_y - mainExtend.max_y) / rgt(1, 2)) + 1); - OGRSpatialReference oSRS; - if (oSRS.importFromEPSG(EPSGCode) != OGRERR_NONE) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::EPSGCODE_NOTSUPPORT)) << "\t" << EPSGCode; - return ErrorCode::EPSGCODE_NOTSUPPORT; - } - - gdalImage resultImage = CreategdalImage(outfileptah, height, width, mainimg.band_num, rgt, EPSGCode, mainType, true, true, isENVI); - - QString resultMaskString = addMaskToFileName(outfileptah, QString("_MASK")); - gdalImage maskImage = CreategdalImage(resultMaskString, height, width, 1, rgt, EPSGCode, GDT_Int32, true, true, isENVI); - - // ʼ - long resultline = Memory1MB * 500 / 8 / resultImage.width; - resultline = resultline < 10000 ? resultline : 10000; // 100 - resultline = resultline > 0 ? resultline : 2; - long bandnum = resultImage.band_num + 1; - long starti = 0; - long rasterCount = imgdslist.count(); - - - - QProgressDialog progressDialog(u8"ʼӰ", u8"ֹ", 0, resultImage.height); - progressDialog.setWindowTitle(u8"ʼӰ"); - progressDialog.setWindowModality(Qt::WindowModal); - progressDialog.setAutoClose(true); - progressDialog.setValue(0); - progressDialog.setMaximum(resultImage.height); - progressDialog.setMinimum(0); - progressDialog.show(); - - - for (starti = 0; starti < resultImage.height; starti = starti + resultline) { - long blocklines = resultline; - blocklines = starti + blocklines < resultImage.height ? blocklines : resultImage.height - starti; - for (long b = 1; b < bandnum; b++) { - Eigen::MatrixXd data = resultImage.getData(starti, 0, blocklines, resultImage.width, b); - Eigen::MatrixXi maskdata = maskImage.getDatai(starti, 0, blocklines, resultImage.width, b); - data = data.array() * 0; - maskdata = maskdata.array() * 0; - resultImage.saveImage(data, starti, 0, b); - maskImage.saveImage(maskdata, starti, 0, b); - } - if (nullptr != dia) { - dia->showProcess(starti * 1.0 / resultImage.height, u8"ʼӰ"); - } - progressDialog.setValue(starti + blocklines); - } - progressDialog.close(); - - - - switch (mergecode) - { - case MERGE_GEOCODING: - return MergeRasterInGeoCoding(imgdslist, resultImage, maskImage, dia); - default: - break; - } - - - return ErrorCode::SUCCESS; -} - -ErrorCode MergeRasterInGeoCoding(QVector imgdslist, gdalImage resultimg, gdalImage maskimg, ShowProessAbstract* dia) -{ - omp_set_num_threads(Paral_num_thread); - // ϲ - QVector extendlist(imgdslist.count()); - for (long i = 0; i < imgdslist.count(); i++) { - extendlist[i] = imgdslist[i].getExtend(); - imgdslist[i].InitInv_gt(); - } - - // ֿ - long resultline = Memory1MB * 1000 / 8 / resultimg.width; - resultline = resultline < 300 ? resultline : 300; // 100 - - long bandnum = resultimg.band_num + 1; - long starti = 0; - long rasterCount = imgdslist.count(); - - long processNumber = 0; - QProgressDialog progressDialog(u8"ϲӰ", u8"ֹ", 0, resultimg.height); - progressDialog.setWindowTitle(u8"ϲӰ"); - progressDialog.setWindowModality(Qt::WindowModal); - progressDialog.setAutoClose(true); - progressDialog.setValue(0); - progressDialog.setMaximum(resultimg.height); - progressDialog.setMinimum(0); - progressDialog.show(); - omp_lock_t lock; - omp_init_lock(&lock); - -#pragma omp parallel for - for (starti = 0; starti < resultimg.height; starti = starti + resultline) { - long blocklines = resultline; - blocklines = starti + blocklines < resultimg.height ? blocklines : resultimg.height - starti; - - long rid = starti; - long cid = 0; - - Landpoint pp = { 0,0,0 }; - Landpoint lp = { 0,0,0 }; - - for (long ir = 0; ir < rasterCount; ir++) {// Ӱ - long minRid = imgdslist[ir].height; - long maxRid = 0; - - Eigen::MatrixXd ridlist = resultimg.getData(starti, 0, blocklines, resultimg.width, 1); - ridlist = ridlist.array() * 0; - Eigen::MatrixXd cidlist = ridlist.array() * 0; - - for (long i = 0; i < blocklines; i++) {// к - rid = starti + i; - for (long j = 0; j < resultimg.width; j++) {// к - cid = j; - resultimg.getLandPoint(rid, cid, 0, pp); - lp = imgdslist[ir].getRow_Col(pp.lon, pp.lat); // ȡ - ridlist(i, j) = lp.lat; - cidlist(i, j) = lp.lon; - } - } - - //ImageShowDialogClass* dialog = new ImageShowDialogClass; - //dialog->show(); - //dialog->load_double_MatrixX_data(cidlist, u8""); - - //dialog->exec(); - - - if (ridlist.maxCoeff() < 0 || ridlist.minCoeff() >= imgdslist[ir].height) { - continue; - } - - if (cidlist.maxCoeff() < 0 || cidlist.minCoeff() >= imgdslist[ir].width) { - continue; - } - - minRid = std::floor(ridlist.minCoeff()); - maxRid = std::ceil(ridlist.maxCoeff()); - minRid = minRid < 0 ? 0 : minRid; - maxRid = maxRid < imgdslist[ir].height ? maxRid : imgdslist[ir].height - 1; - - long rowlen = maxRid - minRid + 1; - if (rowlen <= 0) { - continue; - } - // ȡ - Landpoint p0{ 0,0,0 }, p11{ 0,0,0 }, p21{ 0,0,0 }, p12{ 0,0,0 }, p22{ 0,0,0 }, p{ 0,0,0 }; - - - long rowcount = 0; - long colcount = 0; - double ridtemp = 0, cidtemp = 0; - - long lastr = 0, nextr = 0; - long lastc = 0, nextc = 0; - - double r0 = 0, c0 = 0; - - for (long b = 1; b < bandnum; b++) { - Eigen::MatrixXd resultdata = resultimg.getData(starti, 0, blocklines, resultimg.width, b); - Eigen::MatrixXi resultmask = maskimg.getDatai(starti, 0, blocklines, resultimg.width, b); - Eigen::MatrixXd data = imgdslist[ir].getData(minRid, 0, rowlen, imgdslist[ir].width, b); - - double nodata = imgdslist[ir].getNoDataValue(b); - for (long ii = 0; ii < data.rows(); ii++) { - for (long jj = 0; jj < data.cols(); jj++) { - if (std::abs(data(ii, jj) - nodata) < 1e-6) { - data(ii, jj) = 0; - } - } - } - rowcount = ridlist.rows(); - colcount = ridlist.cols(); - double Bileanervalue = 0; - for (long i = 0; i < rowcount; i++) { - for (long j = 0; j < colcount; j++) { - ridtemp = ridlist(i, j); - cidtemp = cidlist(i, j); - - lastr = std::floor(ridtemp); - nextr = std::ceil(ridtemp); - lastc = std::floor(cidtemp); - nextc = std::ceil(cidtemp); - - if (lastr < 0 || lastr >= imgdslist[ir].height - || nextr < 0 || nextr >= imgdslist[ir].height - || lastc < 0 || lastc >= imgdslist[ir].width - || nextc < 0 || nextc >= imgdslist[ir].width) { - continue; - } - else {} - - r0 = ridtemp - std::floor(ridtemp); - c0 = cidtemp - std::floor(cidtemp); - - lastr = lastr - minRid; - nextr = nextr - minRid; - - p0 = Landpoint{ c0,r0,0 }; - p11 = Landpoint{ 0,0,data(lastr,lastc) }; - p21 = Landpoint{ 0,1,data(nextr,lastc) }; - p12 = Landpoint{ 1,0,data(lastr,nextc) }; - p22 = Landpoint{ 1,1,data(nextr,nextc) }; - Bileanervalue = Bilinear_interpolation(p0, p11, p21, p12, p22); - if (std::abs(Bileanervalue) < 1e-6 || resultmask(i, j) > 0) { - continue; - } - resultdata(i, j) = resultdata(i, j) + Bileanervalue; - resultmask(i, j) = resultmask(i, j) + 1; - } - } - resultimg.saveImage(resultdata, starti, 0, b); - maskimg.saveImage(resultmask, starti, 0, b); - } - } - - omp_set_lock(&lock); - processNumber = processNumber + blocklines; - qDebug() << "\rprocess bar:\t" << processNumber * 100.0 / resultimg.height << " % " << "\t\t\t"; - if (nullptr != dia) { - dia->showProcess(processNumber * 1.0 / resultimg.height, u8"ϲͼ"); - } - if (progressDialog.maximum() <= processNumber) { - processNumber = progressDialog.maximum() - 1; - } - progressDialog.setValue(processNumber); - omp_unset_lock(&lock); - } - omp_destroy_lock(&lock); - - progressDialog.setWindowTitle(u8"ӰĤ"); - progressDialog.setLabelText(u8"ӰĤ"); - for (starti = 0; starti < resultimg.height; starti = starti + resultline) { - long blocklines = resultline; - blocklines = starti + blocklines < resultimg.height ? blocklines : resultimg.height - starti; - for (long b = 1; b < bandnum; b++) { - Eigen::MatrixXd data = resultimg.getData(starti, 0, blocklines, resultimg.width, b); - Eigen::MatrixXd maskdata = maskimg.getData(starti, 0, blocklines, maskimg.width, b); - - for (long i = 0; i < data.rows(); i++) { - for (long j = 0; j < data.cols(); j++) { - if (maskdata(i, j) == 0) { - data(i, j) = -9999; - continue; - } - data(i, j) = data(i, j) / maskdata(i, j); - } - } - - resultimg.saveImage(data, starti, 0, b); - maskimg.saveImage(maskdata, starti, 0, b); - } - if (nullptr != dia) { - dia->showProcess((starti + blocklines) * 1.0 / resultimg.height, u8"ӰĤ"); - } - progressDialog.setValue(starti + blocklines); - } - - - progressDialog.close(); - return ErrorCode::SUCCESS; -} - - -void MergeTiffs(QList inputFiles, QString outputFile) { - GDALAllRegister(); - - if (inputFiles.isEmpty()) { - fprintf(stderr, "No input files provided.\n"); - return; - } - - // Open the first file to determine the data type and coordinate system - GDALDataset* poFirstDS = (GDALDataset*)GDALOpen(inputFiles.first().toUtf8().constData(), GA_ReadOnly); - if (poFirstDS == nullptr) { - fprintf(stderr, "Failed to open the first file %s\n", inputFiles.first().toUtf8().constData()); - return; - } - - double adfGeoTransform[6]; - CPLErr eErr = poFirstDS->GetGeoTransform(adfGeoTransform); - if (eErr != CE_None) { - fprintf(stderr, "Failed to get GeoTransform for the first file %s\n", inputFiles.first().toUtf8().constData()); - GDALClose(poFirstDS); - return; - } - - int nXSize = 0; - int nYSize = 0; - double minX = std::numeric_limits::max(); - double minY = std::numeric_limits::max(); - double maxX = std::numeric_limits::lowest(); - double maxY = std::numeric_limits::lowest(); - double pixelWidth = adfGeoTransform[1]; - double pixelHeight = adfGeoTransform[5]; - - // Determine the bounding box and size of the output raster - for (const QString& inputFile : inputFiles) { - GDALDataset* poSrcDS = (GDALDataset*)GDALOpen(inputFile.toUtf8().constData(), GA_ReadOnly); - if (poSrcDS == nullptr) { - fprintf(stderr, "Failed to open %s\n", inputFile.toUtf8().constData()); - continue; - } - - double adfThisTransform[6]; - eErr = poSrcDS->GetGeoTransform(adfThisTransform); - if (eErr != CE_None) { - fprintf(stderr, "Failed to get GeoTransform for %s\n", inputFile.toUtf8().constData()); - GDALClose(poSrcDS); - continue; - } - - minX = std::min(minX, adfThisTransform[0]); - minY = std::min(minY, adfThisTransform[3] + adfThisTransform[5] * poSrcDS->GetRasterYSize()); - maxX = std::max(maxX, adfThisTransform[0] + adfThisTransform[1] * poSrcDS->GetRasterXSize()); - maxY = std::max(maxY, adfThisTransform[3]); - - GDALClose(poSrcDS); - } - - nXSize = static_cast(std::ceil((maxX - minX) / pixelWidth)); - nYSize = static_cast(std::ceil((maxY - minY) / (-pixelHeight))); - - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - if (poDriver == nullptr) { - fprintf(stderr, "GTiff driver not available.\n"); - GDALClose(poFirstDS); - return; - } - - char** papszOptions = nullptr; - GDALDataset* poDstDS = poDriver->Create(outputFile.toUtf8().constData(), nXSize, nYSize, 1, poFirstDS->GetRasterBand(1)->GetRasterDataType(), papszOptions); - if (poDstDS == nullptr) { - fprintf(stderr, "Creation of output file failed.\n"); - GDALClose(poFirstDS); - return; - } - - poDstDS->SetGeoTransform(adfGeoTransform); - - const OGRSpatialReference* oSRS = poFirstDS->GetSpatialRef(); - poDstDS->SetSpatialRef(oSRS); - - float fillValue = std::numeric_limits::quiet_NaN(); - void* pafScanline = CPLMalloc(GDALGetDataTypeSizeBytes(poFirstDS->GetRasterBand(1)->GetRasterDataType()) * nXSize); - memset(pafScanline, 0, GDALGetDataTypeSizeBytes(poFirstDS->GetRasterBand(1)->GetRasterDataType()) * nXSize); - - // Initialize all pixels to NaN - for (int iY = 0; iY < nYSize; ++iY) { - GDALRasterBand* poBand = poDstDS->GetRasterBand(1); - poBand->RasterIO(GF_Write, 0, iY, nXSize, 1, pafScanline, nXSize, 1, poFirstDS->GetRasterBand(1)->GetRasterDataType(), 0, 0); - } - - CPLFree(pafScanline); - - // Read each source image and write into the destination image - for (const QString& inputFile : inputFiles) { - GDALDataset* poSrcDS = (GDALDataset*)GDALOpen(inputFile.toUtf8().constData(), GA_ReadOnly); - if (poSrcDS == nullptr) { - fprintf(stderr, "Failed to open %s\n", inputFile.toUtf8().constData()); - continue; - } - - double adfThisTransform[6]; - poSrcDS->GetGeoTransform(adfThisTransform); - - int srcXSize = poSrcDS->GetRasterXSize(); - int srcYSize = poSrcDS->GetRasterYSize(); - - int dstXOffset = static_cast(std::round((adfThisTransform[0] - minX) / pixelWidth)); - int dstYOffset = static_cast(std::round((maxY - adfThisTransform[3]) / (-pixelHeight))); - - GDALRasterBand* poSrcBand = poSrcDS->GetRasterBand(1); - GDALRasterBand* poDstBand = poDstDS->GetRasterBand(1); - - void* pafBuffer = CPLMalloc(GDALGetDataTypeSizeBytes(poFirstDS->GetRasterBand(1)->GetRasterDataType()) * srcXSize * srcYSize); - poSrcBand->RasterIO(GF_Read, 0, 0, srcXSize, srcYSize, pafBuffer, srcXSize, srcYSize, poFirstDS->GetRasterBand(1)->GetRasterDataType(), 0, 0); - - poDstBand->RasterIO(GF_Write, dstXOffset, dstYOffset, srcXSize, srcYSize, pafBuffer, srcXSize, srcYSize, poFirstDS->GetRasterBand(1)->GetRasterDataType(), 0, 0); - - CPLFree(pafBuffer); - GDALClose(poSrcDS); - } - - GDALClose(poDstDS); - GDALClose(poFirstDS); - -} - - - diff --git a/BaseCommonLibrary/BaseTool/PrintMsgToQDebug.cpp b/BaseCommonLibrary/BaseTool/PrintMsgToQDebug.cpp deleted file mode 100644 index 5d7d190..0000000 --- a/BaseCommonLibrary/BaseTool/PrintMsgToQDebug.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "PrintMsgToQDebug.h" -#include -BASECONSTVARIABLEAPI void PrintMsgToQDebug(char* msg) -{ - qDebug() << QString(msg); - return ; -} - -BASECONSTVARIABLEAPI void PrintfToQDebug(const char* msg) -{ - qDebug() << QString(msg); - return; -} - -BASECONSTVARIABLEAPI void PrintTipMsgToQDebug(const char* tip, const char* msg) -{ - qDebug() < -extern "C" BASECONSTVARIABLEAPI void PrintMsgToQDebug(char* msg); -extern "C" BASECONSTVARIABLEAPI void PrintfToQDebug(const char* msg); -extern "C" BASECONSTVARIABLEAPI void PrintTipMsgToQDebug(const char* tip, const char* msg); -extern "C" BASECONSTVARIABLEAPI void printfinfo(const char* format, ...); -#endif // !PRINTMSGTOQDEBUG_H_ - - - \ No newline at end of file diff --git a/BaseCommonLibrary/BaseTool/QToolProcessBarDialog.cpp b/BaseCommonLibrary/BaseTool/QToolProcessBarDialog.cpp deleted file mode 100644 index a39fd57..0000000 --- a/BaseCommonLibrary/BaseTool/QToolProcessBarDialog.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "QToolProcessBarDialog.h" -#include "ui_QToolProcessBarDialog.h" - -QToolProcessBarDialog::QToolProcessBarDialog(QWidget *parent) - : ui(new Ui::QToolProcessBarDialogClass), QDialog(parent) -{ - ui->setupUi(this); - ui->progressBar->setRange(0, 100); -} - -QToolProcessBarDialog::~QToolProcessBarDialog() -{} - -void QToolProcessBarDialog::showProcess(double precent, QString tip) -{ - ui->progressBar->setValue(std::ceil(precent * 100)); - ui->labelTip->setText(tip); - this->update(); -} - -void QToolProcessBarDialog::showToolInfo(QString tip) -{ - ui->textEditTip->append("\n"+tip); -} diff --git a/BaseCommonLibrary/BaseTool/QToolProcessBarDialog.h b/BaseCommonLibrary/BaseTool/QToolProcessBarDialog.h deleted file mode 100644 index 8b1d5bf..0000000 --- a/BaseCommonLibrary/BaseTool/QToolProcessBarDialog.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once -#include "BaseConstVariable.h" -#include - -#include "ImageOperatorBase.h" - -namespace Ui { - class QToolProcessBarDialogClass; -} - -class BASECONSTVARIABLEAPI QToolProcessBarDialog : public QDialog, public ShowProessAbstract -{ - Q_OBJECT -public: - QToolProcessBarDialog(QWidget *parent = nullptr); - ~QToolProcessBarDialog(); - -private: - Ui::QToolProcessBarDialogClass* ui; -public: - virtual void showProcess(double precent, QString tip) override; - virtual void showToolInfo(QString tip) override; -}; diff --git a/BaseCommonLibrary/BaseTool/QToolProcessBarDialog.ui b/BaseCommonLibrary/BaseTool/QToolProcessBarDialog.ui deleted file mode 100644 index 400efab..0000000 --- a/BaseCommonLibrary/BaseTool/QToolProcessBarDialog.ui +++ /dev/null @@ -1,73 +0,0 @@ - - - QToolProcessBarDialogClass - - - - 0 - 0 - 600 - 400 - - - - QToolProcessBarDialog - - - - - - - - - - 120 - 26 - - - - - 120 - 26 - - - - 退出 - - - - - - - 提示 - - - - - - - 24 - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BaseCommonLibrary/BaseTool/RasterToolBase.cpp b/BaseCommonLibrary/BaseTool/RasterToolBase.cpp deleted file mode 100644 index 5debe6f..0000000 --- a/BaseCommonLibrary/BaseTool/RasterToolBase.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/** - * @file RasterProjectBase.cpp - * @brief None - * @author 陈增辉 (3045316072@qq.com) - * @version 2.5.0 - * @date 24-6-4 - * @copyright Copyright (c) Since 2024 中科卫星应用研究院 All rights reserved. - */ - -#include -#include "RasterToolBase.h" -#include "gdal_priv.h" -#include "ogr_spatialref.h" -#include "cpl_conv.h" // for CPLMalloc() -#include -#include -#include -#include "SARSimulationImageL1.h" -#include - -namespace RasterToolBase { - long getProjectEPSGCodeByLon_Lat(double lon, double lat, ProjectStripDelta stripState) - { - long EPSGCode = 0; - switch(stripState) { - case ProjectStripDelta::Strip_3: { - break; - }; - case ProjectStripDelta::Strip_6: { - break; - } - default: { - EPSGCode = -1; - break; - } - } - qDebug() << QString(" EPSG code : %1").arg(EPSGCode); - return EPSGCode; - } - long getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat) - { - // EPSG 4534 ~ 4554 3 度带 - // 首先判断是否是在 中国带宽范围 - // 中心经度范围 :75E ~ 135E 实际范围 73.5E ~ 136.5E, - // 纬度范围 3N ~ 54N,放宽到 0N~ 60N - if(73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // 中国境内 - long code = trunc((lon - 73.5) / 3) + 4534; - return code; - } else { // 非中国境内 使用 高斯克吕格 - bool isSouth = lat < 0; // 简单判断南北半球,这里仅为示例,实际应用可能需要更细致的逻辑 - long prefix = isSouth ? 327000 : 326000; - // std::string prefix = isSouth ? "327" : "326"; - lon = fmod(lon + 360.0, 360.0); - long zone = std::floor((lon + 180.0) / 3.0); - prefix = prefix + zone; - return prefix; - } - return 0; - } - long getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat) - { - // EPSG 4502 ~ 4512 6度带 - // 首先判断是否是在 中国带宽范围 - // 中心经度范围 :75E ~ 135E 实际范围 72.0E ~ 138E, - // 纬度范围 3N ~ 54N,放宽到 0N~ 60N - if(73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // 中国境内 - long code = trunc((lon - 72.0) / 6) + 4502; - return code; - } else { // 非中国境内 使用 UTM// 确定带号,6度带从1开始到60,每6度一个带 - int zone = static_cast((lon + 180.0) / 6.0) + 1; - bool isSouth = lon < 0; // 判断是否在南半球 - long epsgCodeBase = isSouth ? 32700 : 32600; // 计算EPSG代码 - long prefix = static_cast(epsgCodeBase + zone); - return prefix; - } - return 0; - } - - QString GetProjectionNameFromEPSG(long epsgCode) - { - qDebug() << "============= GetProjectionNameFromEPSG ======================"; - OGRSpatialReference oSRS; - - // 设置EPSG代码 - if(oSRS.importFromEPSG(epsgCode) != OGRERR_NONE) { - qDebug() << "epsgcode not recognition"; - return ""; - } - - // 获取并输出坐标系的描述(名称) - const char* pszName = oSRS.GetAttrValue("GEOGCS"); - if(pszName) { - qDebug() << "Coordinate system name for EPSG " + QString::number(epsgCode) - << " is: " + QString::fromStdString(pszName); - return QString::fromStdString(pszName); - } else { - qDebug() << "Unable to retrieve the name for EPSG " + QString::number(epsgCode); - return ""; - } - - // char* wkt = NULL; - // // 转换为WKT格式 - // oSRS.exportToWkt(&wkt); - // - // qDebug() << wkt; - // - // // 从WKT中解析投影名称,这里简化处理,实际可能需要更复杂的逻辑来准确提取名称 - // std::string wktStr(wkt); - // long start = wktStr.find("PROJCS[\"") + 8; // 找到"PROJCS["后的第一个双引号位置 - // // 从start位置开始找下一个双引号,这之间的内容即为投影名称 - // int end = wktStr.find('\"', start); - // QString projName = QString::fromStdString(wktStr.substr(start, end - start)); - // - // // 释放WKT字符串内存 - // CPLFree(wkt); - - // return projName; - } - long GetEPSGFromRasterFile(QString filepath) - { - qDebug() << "============= GetEPSGFromRasterFile ======================"; - // QTextCodec* codec = QTextCodec::codecForLocale(); // 获取系统默认编码的文本编解码器 - // QByteArray byteArray = codec->fromUnicode(filepath); // 将QString转换为QByteArray - //,这个应该会自动释放 const char* charArray = byteArray.constData(); // - // 获取QByteArray的const char*指针 - - { - if(QFile(filepath).exists()){ - qDebug() << "info: the image found.\n"; - }else{ - return -1; - } - - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // 注册GDAL驱动 - // qDebug()<GetProjectionRef(); - - qDebug() << QString::fromUtf8(pszProjection); - - // 创建SpatialReference对象 - OGRSpatialReference oSRS; - if(oSRS.importFromWkt((char**)&pszProjection) != OGRERR_NONE) { - qDebug() << ("Error: Unable to import projection information.\n"); - GDALClose(poDataset); - return -1; - } - - long epsgCode = atoi(oSRS.GetAuthorityCode(nullptr)); // 获取EPSG代码 - - if(epsgCode != 0) { - GDALClose(poDataset); - qDebug() << QString("file %1 :epsg Code %2").arg(filepath).arg(epsgCode); - return epsgCode; - } else { - qDebug() << "EPSG code could not be determined from the spatial reference."; - GDALClose(poDataset); - return -1; - } - } - } - std::shared_ptr GetCenterPointInRaster(QString filepath) - { - qDebug() << "============= GetCenterPointInRaster ======================"; - // QTextCodec* codec = QTextCodec::codecForLocale(); // 获取系统默认编码的文本编解码器 - // QByteArray byteArray = codec->fromUnicode(filepath); // 将QString转换为QByteArray - //,这个应该会自动释放 const char* charArray = byteArray.constData(); // - // 获取QByteArray的const char*指针 - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - // qDebug()<GetGeoTransform(adfGeoTransform) != CE_None) { - qDebug() << "Failed to get GeoTransform"; - return nullptr; - } - - double dfWidth = poDataset->GetRasterXSize(); - double dfHeight = poDataset->GetRasterYSize(); - - // 计算中心点坐标(像素坐标) - double dfCenterX = adfGeoTransform[0] + dfWidth * adfGeoTransform[1] / 2.0 - + dfHeight * adfGeoTransform[2] / 2.0; - double dfCenterY = adfGeoTransform[3] + dfWidth * adfGeoTransform[4] / 2.0 - + dfHeight * adfGeoTransform[5] / 2.0; - - OGRSpatialReference oSRS; - oSRS.importFromWkt(poDataset->GetProjectionRef()); - - if(oSRS.IsGeographic()) { - qDebug() << "Center coords (already in geographic): (" + QString::number(dfCenterX) - + ", " + QString::number(dfCenterY) + ")"; - flag = true; - x = dfCenterX; - y = dfCenterY; - } else { - // 如果不是地理坐标系,转换到WGS84 - OGRSpatialReference oSRS_WGS84; - oSRS_WGS84.SetWellKnownGeogCS("WGS84"); - - OGRCoordinateTransformation* poCT = - OGRCreateCoordinateTransformation(&oSRS, &oSRS_WGS84); - if(poCT == nullptr) { - qDebug() << "Failed to create coordinate transformation"; - return nullptr; - } - - // double dfLon, dfLat; - if(poCT->Transform(1, &dfCenterX, &dfCenterY)) { - qDebug() << "Center coords (transformed to WGS84): (" - + QString::number(dfCenterX) + ", " + QString::number(dfCenterY) - << ")"; - flag = true; - x = dfCenterX; - y = dfCenterY; - } else { - qDebug() << "Transformation failed."; - } - OGRCoordinateTransformation::DestroyCT(poCT); - } - } - if(nullptr==poDataset||NULL==poDataset){}else{ - GDALClose(poDataset); - } - - if(flag) { - std::shared_ptr RasterCenterPoint = std::make_shared(); - RasterCenterPoint->x = x; - RasterCenterPoint->y = y; - RasterCenterPoint->z = 0; - return RasterCenterPoint; - } else { - return nullptr; - } - } - CoordinateSystemType getCoordinateSystemTypeByEPSGCode(long epsg_code) - { - OGRSpatialReference oSRS; - if(oSRS.importFromEPSG(epsg_code) == OGRERR_NONE) { - if(oSRS.IsGeographic()) { - return CoordinateSystemType::GeoCoordinateSystem; - } else if(oSRS.IsProjected()) { - return CoordinateSystemType::ProjectCoordinateSystem; - } - else { - return CoordinateSystemType::UNKNOW; - } - } else { - return CoordinateSystemType::UNKNOW; - } - } -}; // namespace RasterToolBase - - - diff --git a/BaseCommonLibrary/BaseTool/RasterToolBase.h b/BaseCommonLibrary/BaseTool/RasterToolBase.h deleted file mode 100644 index 254d4bb..0000000 --- a/BaseCommonLibrary/BaseTool/RasterToolBase.h +++ /dev/null @@ -1,96 +0,0 @@ -/** - * @file RasterProjectBase.h - * @brief None - * @author 陈增辉 (3045316072@qq.com) - * @version 2.5.0 - * @date 24-6-4 - * @copyright Copyright (c) Since 2024 中科卫星应用研究院 All rights reserved. - */ - -#ifndef LAMPCAE_RASTERTOOLBASE_H -#define LAMPCAE_RASTERTOOLBASE_H -#include "BaseConstVariable.h" -#include "gdal_priv.h" -#include -#include "LogInfoCls.h" - - -namespace RasterToolBase { - - static bool GDALAllRegisterEnable = false; - - - enum ProjectStripDelta { - Strip_6, // 6度带 - Strip_3 - }; - - enum CoordinateSystemType { // 坐标系类型 - GeoCoordinateSystem, - ProjectCoordinateSystem, - UNKNOW - }; - - struct PointRaster { // 影像坐标点 - double x; - double y; - double z; - }; - - - struct PointXYZ { - double x, y, z; - }; - - struct PointGeo { - double lon, lat, ati; - }; - - struct PointImage { - double pixel_x, pixel_y; - }; - - /// 根据经纬度获取 - /// EPSG代码,根据经纬度返回对应投影坐标系统,其中如果在中华人民共和国境内,默认使用 - /// CGCS2000坐标系统(EPSG 4502 ~ 4512 6度带,EPSG 4534 ~ 4554 3度带),其余地方使用WGS坐标系统, - /// 投影方法 高斯克吕格(国内), 高斯克吕格 - /// \param long 经度 - /// \param lat 纬度 - /// \return 对应投影坐标系统的 EPSG编码,-1 表示计算错误 - long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double long, double lat, - ProjectStripDelta stripState = ProjectStripDelta::Strip_3); - - long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat); - - long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat); - - - QString BASECONSTVARIABLEAPI GetProjectionNameFromEPSG(long epsgCode); - - - long BASECONSTVARIABLEAPI GetEPSGFromRasterFile(QString filepath); - - std::shared_ptr BASECONSTVARIABLEAPI GetCenterPointInRaster(QString filepath); - - CoordinateSystemType BASECONSTVARIABLEAPI getCoordinateSystemTypeByEPSGCode(long EPSGCODE); - -};// namespace RasterProjectConvertor - - - - -// 遥感类常用数据 - - - - - - - - - - - - - -#endif // LAMPCAE_RASTERTOOLBASE_H diff --git a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp deleted file mode 100644 index 2fbfbb8..0000000 --- a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp +++ /dev/null @@ -1,1001 +0,0 @@ -#include "stdafx.h" -#include "SARSimulationImageL1.h" -#include "LogInfoCls.h" -#include -#include -#include -#include - -SARSimulationImageL1Dataset::SARSimulationImageL1Dataset(RasterLevel level) -{ - this->Rasterlevel = level; -} - -SARSimulationImageL1Dataset::~SARSimulationImageL1Dataset() -{ -} - -RasterLevel SARSimulationImageL1Dataset::getRasterLevel() -{ - return this->Rasterlevel; -} - -QString SARSimulationImageL1Dataset::getoutFolderPath() -{ - return outFolderPath; -} - -QString SARSimulationImageL1Dataset::getDatesetName() -{ - return L1DatasetName; -} - -QString SARSimulationImageL1Dataset::getxmlfileName() -{ - return xmlfileName; -} - -QString SARSimulationImageL1Dataset::getxmlFilePath() -{ - return xmlFilePath; -} - -QString SARSimulationImageL1Dataset::getImageRasterName() -{ - return ImageRasterName; -} - -QString SARSimulationImageL1Dataset::getImageRasterPath() -{ - return ImageRasterPath; -} - -QString SARSimulationImageL1Dataset::getGPSPointFilename() -{ - if (this->Rasterlevel == RasterLevel::RasterL2) { - return ""; - } - return GPSPointFilename; -} - -QString SARSimulationImageL1Dataset::getGPSPointFilePath() -{ - if (this->Rasterlevel == RasterLevel::RasterL2) { - return ""; - } - return GPSPointFilePath; -} - -ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filename, long inrowCount, long incolCount) -{ - qDebug() << "--------------Image Raster L1 Data OpenOrNew ---------------------------------------"; - qDebug() << "Folder: " << folder; - qDebug() << "Filename: " << filename; - QDir dir(folder); - if (dir.exists() == false) - { - dir.mkpath(folder); - } - else {} - - if (dir.exists() == false) { - return ErrorCode::FOLDER_NOT_EXIST; - } - else {} - QString filePath = dir.filePath(filename); // ļ· - this->rowCount = inrowCount; - this->colCount = incolCount; - - this->outFolderPath = folder; - this->L1DatasetName = filename; - - this->xmlfileName = filename + ".xml"; - this->GPSPointFilename = filename + ".gpspos.data"; - this->ImageRasterName = filename + ".bin"; - - this->xmlFilePath = dir.filePath(this->xmlfileName); - this->GPSPointFilePath = dir.filePath(this->GPSPointFilename); - this->ImageRasterPath = dir.filePath(this->ImageRasterName); - - if (QFile(this->xmlFilePath).exists()) - { - this->loadFromXml(); - } - else - { - this->saveToXml(); - } - - if (this->Rasterlevel==RasterL2||QFile(this->GPSPointFilePath).exists() == false) { - // ļ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - std::shared_ptr poDstDS(poDriver->Create(this->GPSPointFilePath.toUtf8().constData(), 19, rowCount, 1, GDT_Float64, NULL)); - GDALFlushCache((GDALDatasetH)poDstDS.get()); - poDstDS.reset(); - omp_unset_lock(&lock); - omp_destroy_lock(&lock); - } - - else if (this->Rasterlevel == RasterLevel::RasterSLC || QFile(this->ImageRasterPath).exists() == false) { - - // ļ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - std::shared_ptr poDstDS(poDriver->Create(this->ImageRasterPath.toUtf8().constData(), colCount, rowCount, 1, GDT_CFloat32, NULL)); - GDALFlushCache((GDALDatasetH)poDstDS.get()); - poDstDS.reset(); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - } - - - else if (this->Rasterlevel == RasterLevel::RasterL1B || QFile(this->ImageRasterPath).exists() == false) { - - // ļ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - std::shared_ptr poDstDS(poDriver->Create(this->GPSPointFilePath.toUtf8().constData(), 19, rowCount, 1, GDT_Float64, NULL)); - GDALFlushCache((GDALDatasetH)poDstDS.get()); - poDstDS.reset(); - omp_unset_lock(&lock); - omp_destroy_lock(&lock); - } - - - return ErrorCode::SUCCESS; -} - -ErrorCode SARSimulationImageL1Dataset::Open(QString folder, QString filename) -{ - - QDir dir(folder); - if (dir.exists() == false) - { - return ErrorCode::FOLDER_NOT_EXIST; - } - else {} - - if (dir.exists() == false) { - return ErrorCode::FOLDER_NOT_EXIST; - } - else {} - QString filePath = dir.filePath(filename); // ļ· - - this->outFolderPath = folder; - this->L1DatasetName = filename; - - this->xmlfileName = filename + ".xml"; - this->GPSPointFilename = filename + ".gpspos.data"; - this->ImageRasterName = filename + ".bin"; - - this->xmlFilePath = dir.filePath(this->xmlfileName); - this->GPSPointFilePath = dir.filePath(this->GPSPointFilename); - this->ImageRasterPath = dir.filePath(this->ImageRasterName); - - if (QFile(this->xmlFilePath).exists()) - { - this->loadFromXml(); - } - else - { - return ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR; - } -} - -ErrorCode SARSimulationImageL1Dataset::Open(QString xmlPath) -{ - QFileInfo fileInfo(xmlPath); - QString fileName = fileInfo.fileName(); // ȡļ - QString fileSuffix = fileInfo.suffix(); // ȡ׺ - QString fileNameWithoutSuffix = fileInfo.completeBaseName(); // ȡ׺ļ - QString directoryPath = fileInfo.path(); // ȡļ· - if (fileSuffix.toLower() == "xml" || fileSuffix.toLower() == ".xml") { - return this->Open(directoryPath, fileNameWithoutSuffix); - } - else { - return ErrorCode::IMAGE_L1DATA_XMLNAMEERROR; - } - return ErrorCode::SUCCESS; - -} - -void SARSimulationImageL1Dataset::saveToXml() -{ - QFile file(this->xmlFilePath); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - qDebug() << "Cannot open file for writing:" << file.errorString(); - return; - } - - QXmlStreamWriter xmlWriter(&file); - xmlWriter.setAutoFormatting(true); - - xmlWriter.writeStartDocument(); - xmlWriter.writeStartElement("Parameters"); - - switch (this->Rasterlevel) - { - case(RasterLevel::RasterSLC): - xmlWriter.writeTextElement("rasterlevel", "SLC"); - break; - case(RasterLevel::RasterL1B): - xmlWriter.writeTextElement("rasterlevel", "L1B"); - break; - case(RasterLevel::RasterL2): - xmlWriter.writeTextElement("rasterlevel", "L2"); - break; - default: - break; - } - - xmlWriter.writeTextElement("RowCount", QString::number(this->rowCount)); - xmlWriter.writeTextElement("ColCount", QString::number(this->colCount)); - xmlWriter.writeTextElement("Rnear", QString::number(this->Rnear, 'e', 18)); - xmlWriter.writeTextElement("Rfar", QString::number(this->Rfar, 'e', 18)); - xmlWriter.writeTextElement("Rref", QString::number(this->Rref, 'e', 18)); - xmlWriter.writeTextElement("CenterFreq", QString::number(this->centerFreq, 'e', 18)); - xmlWriter.writeTextElement("Fs", QString::number(this->Fs, 'e', 18)); - xmlWriter.writeTextElement("PRF", QString::number(this->prf, 'e', 18)); - xmlWriter.writeTextElement("CenterAngle", QString::number(this->CenterAngle, 'e', 18)); - xmlWriter.writeTextElement("LookSide", this->LookSide); - - // sateantpos - xmlWriter.writeStartElement("AntPos"); - - for (long i = 0; i < this->sateposes.count(); i++) { - xmlWriter.writeStartElement("AntPosParam"); - xmlWriter.writeTextElement("time", QString::number(this->sateposes[i].time, 'e', 18)); // time - xmlWriter.writeTextElement("Px", QString::number(this->sateposes[i].Px, 'e', 18)); // Px - xmlWriter.writeTextElement("Py", QString::number(this->sateposes[i].Py, 'e', 18)); // Py - xmlWriter.writeTextElement("Pz", QString::number(this->sateposes[i].Pz, 'e', 18)); // Pz - xmlWriter.writeTextElement("Vx", QString::number(this->sateposes[i].Vx, 'e', 18)); // Vx - xmlWriter.writeTextElement("Vy", QString::number(this->sateposes[i].Vy, 'e', 18)); // Vy - xmlWriter.writeTextElement("Vz", QString::number(this->sateposes[i].Vz, 'e', 18)); // Vz - xmlWriter.writeTextElement("AntDirectX", QString::number(this->sateposes[i].AntDirectX, 'e', 18)); // AntDirectX - xmlWriter.writeTextElement("AntDirectY", QString::number(this->sateposes[i].AntDirectY, 'e', 18)); // AntDirectY - xmlWriter.writeTextElement("AntDirectZ", QString::number(this->sateposes[i].AntDirectZ, 'e', 18)); // AntDirectZ - xmlWriter.writeTextElement("AVx", QString::number(this->sateposes[i].AVx, 'e', 18)); // AVx - xmlWriter.writeTextElement("AVy", QString::number(this->sateposes[i].AVy, 'e', 18)); // AVy - xmlWriter.writeTextElement("AVz", QString::number(this->sateposes[i].AVz, 'e', 18)); // AVz - xmlWriter.writeTextElement("lon", QString::number(this->sateposes[i].lon, 'e', 18)); // lon - xmlWriter.writeTextElement("lat", QString::number(this->sateposes[i].lat, 'e', 18)); // lat - xmlWriter.writeTextElement("ati", QString::number(this->sateposes[i].ati, 'e', 18)); // ati - xmlWriter.writeEndElement(); // - } - - xmlWriter.writeTextElement("ImageStartTime", QString::number(this->startImageTime, 'e', 18)); - xmlWriter.writeTextElement("ImageEndTime", QString::number(this->EndImageTime, 'e', 18)); - - xmlWriter.writeTextElement("incidenceAngleNearRange", QString::number(this->incidenceAngleNearRange, 'e', 18)); - xmlWriter.writeTextElement("incidenceAngleFarRange", QString::number(this->incidenceAngleFarRange, 'e', 18)); - xmlWriter.writeTextElement("TotalProcessedAzimuthBandWidth", QString::number(this->TotalProcessedAzimuthBandWidth, 'e', 18)); - xmlWriter.writeTextElement("DopplerParametersReferenceTime", QString::number(this->DopplerParametersReferenceTime, 'e', 18)); - - xmlWriter.writeStartElement("DopplerCentroidCoefficients"); - xmlWriter.writeTextElement("d0", QString::number(this->d0, 'e', 18)); - xmlWriter.writeTextElement("d1", QString::number(this->d1, 'e', 18)); - xmlWriter.writeTextElement("d2", QString::number(this->d2, 'e', 18)); - xmlWriter.writeTextElement("d3", QString::number(this->d3, 'e', 18)); - xmlWriter.writeTextElement("d4", QString::number(this->d4, 'e', 18)); - xmlWriter.writeEndElement(); // DopplerCentroidCoefficients - - xmlWriter.writeStartElement("DopplerRateValuesCoefficients"); - xmlWriter.writeTextElement("r0", QString::number(this->r0, 'e', 18)); - xmlWriter.writeTextElement("r1", QString::number(this->r1, 'e', 18)); - xmlWriter.writeTextElement("r2", QString::number(this->r2, 'e', 18)); - xmlWriter.writeTextElement("r3", QString::number(this->r3, 'e', 18)); - xmlWriter.writeTextElement("r4", QString::number(this->r4, 'e', 18)); - xmlWriter.writeEndElement(); // DopplerRateValuesCoefficients - - - xmlWriter.writeTextElement("latitude_center", QString::number(this->latitude_center, 'e', 18)); - xmlWriter.writeTextElement("longitude_center", QString::number(this->longitude_center, 'e', 18)); - xmlWriter.writeTextElement("latitude_topLeft", QString::number(this->latitude_topLeft, 'e', 18)); - xmlWriter.writeTextElement("longitude_topLeft", QString::number(this->longitude_topLeft, 'e', 18)); - xmlWriter.writeTextElement("latitude_topRight", QString::number(this->latitude_topRight, 'e', 18)); - xmlWriter.writeTextElement("longitude_topRight", QString::number(this->longitude_topRight, 'e', 18)); - xmlWriter.writeTextElement("latitude_bottomLeft", QString::number(this->latitude_bottomLeft, 'e', 18)); - xmlWriter.writeTextElement("longitude_bottomLeft", QString::number(this->longitude_bottomLeft, 'e', 18)); - xmlWriter.writeTextElement("latitude_bottomRight", QString::number(this->latitude_bottomRight, 'e', 18)); - xmlWriter.writeTextElement("longitude_bottomRight", QString::number(this->longitude_bottomRight, 'e', 18)); - - xmlWriter.writeEndElement(); // Parameters - xmlWriter.writeEndDocument(); - - file.close(); -} - -ErrorCode SARSimulationImageL1Dataset::loadFromXml() -{ - QFile file(this->xmlFilePath); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qDebug() << "Cannot open file for reading:" << file.errorString(); - return ErrorCode::IMAGE_L1DATA_XMLNAMEOPENERROR; - } - - QXmlStreamReader xmlReader(&file); - while (!xmlReader.atEnd() && !xmlReader.hasError()) { - QXmlStreamReader::TokenType token = xmlReader.readNext(); - if (token == QXmlStreamReader::StartDocument) { - continue; - } - if (token == QXmlStreamReader::StartElement) { - if (xmlReader.name() == "Parameters") { - continue; - } - else if (xmlReader.name() == "rasterlevel") { - QString rasterlevelstr = xmlReader.readElementText(); - if (rasterlevelstr == "SLC") { - this->Rasterlevel = RasterLevel::RasterSLC; - } - else if (rasterlevelstr == "L1B") { - this->Rasterlevel = RasterLevel::RasterL1B; - } - else if (rasterlevelstr == "L2") { - this->Rasterlevel = RasterLevel::RasterL2; - } - } - else if (xmlReader.name() == "RowCount") { - this->rowCount = xmlReader.readElementText().toLong(); - } - else if (xmlReader.name() == "ColCount") { - this->colCount = xmlReader.readElementText().toLong(); - } - else if (xmlReader.name() == "Rnear") { - this->Rnear = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "Rfar") { - this->Rfar = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "Rref") { - this->Rref = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "CenterFreq") { - this->centerFreq = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "Fs") { - this->Fs = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "PRF") { - this->prf = xmlReader.readElementText().toDouble(); - } - else if(xmlReader.name() == "ImageStartTime"){ - this->startImageTime = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "ImageEndTime") { - this->EndImageTime = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "CenterAngle") { - this->CenterAngle = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "LookSide") { - this->LookSide = xmlReader.readElementText(); - } - else if (xmlReader.name() == "AntPosParam") { - SatelliteAntPos antPosParam; - while (!(xmlReader.isEndElement() && xmlReader.name() == "AntPosParam")) { - if (xmlReader.isStartElement()) { - if (xmlReader.name() == "time") { - antPosParam.time = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "Px") { - antPosParam.Px = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "Py") { - antPosParam.Py = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "Pz") { - antPosParam.Pz = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "Vx") { - antPosParam.Vx = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "Vy") { - antPosParam.Vy = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "Vz") { - antPosParam.Vz = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "AntDirectX") { - antPosParam.AntDirectX = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "AntDirectY") { - antPosParam.AntDirectY = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "AntDirectZ") { - antPosParam.AntDirectZ = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "AVx") { - antPosParam.AVx = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "AVy") { - antPosParam.AVy = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "AVz") { - antPosParam.AVz = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "lon") { - antPosParam.lon = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "lat") { - antPosParam.lat = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "ati") { - antPosParam.ati = xmlReader.readElementText().toDouble(); - } - } - xmlReader.readNext(); - } - - sateposes.append(antPosParam); // ӵб - } - else if (xmlReader.name() == "incidenceAngleNearRange") { - incidenceAngleNearRange = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "incidenceAngleFarRange") { - incidenceAngleFarRange = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "TotalProcessedAzimuthBandWidth") { - this->TotalProcessedAzimuthBandWidth = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "DopplerParametersReferenceTime") { - this->DopplerParametersReferenceTime = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "DopplerCentroidCoefficients") { - - while (!(xmlReader.tokenType() == QXmlStreamReader::EndElement && xmlReader.name() == "DopplerCentroidCoefficients")) { - if (xmlReader.tokenType() == QXmlStreamReader::StartElement) { - if (xmlReader.name() == "d0") { - this->d0 = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "d1") { - this->d1 = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "d2") { - this->d2 = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "d3") { - this->d3 = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "d4") { - this->d4 = xmlReader.readElementText().toDouble(); - } - } - xmlReader.readNext(); - } - } - else if (xmlReader.name() == "DopplerRateValuesCoefficients") { - while (!(xmlReader.tokenType() == QXmlStreamReader::EndElement && xmlReader.name() == "DopplerRateValuesCoefficients")) { - if (xmlReader.tokenType() == QXmlStreamReader::StartElement) { - if (xmlReader.name() == "r0") { - this->r0 = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "r1") { - this->r1 = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "r2") { - this->r2 = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "r3") { - this->r3 = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "r4") { - this->r4 = xmlReader.readElementText().toDouble(); - } - } - xmlReader.readNext(); - } - } - else if (xmlReader.name() == "latitude_center") { - this->latitude_center = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "longitude_center") { - this->longitude_center = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "latitude_topLeft") { - this->latitude_topLeft = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "longitude_topLeft") { - this->longitude_topLeft = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "latitude_topRight") { - this->latitude_topRight = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "longitude_topRight") { - this->longitude_topRight = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "latitude_bottomLeft") { - this->latitude_bottomLeft = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "longitude_bottomLeft") { - this->longitude_bottomLeft = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "latitude_bottomRight") { - this->latitude_bottomRight = xmlReader.readElementText().toDouble(); - } - else if (xmlReader.name() == "longitude_bottomRight") { - this->longitude_bottomRight = xmlReader.readElementText().toDouble(); - } - } - } - - if (xmlReader.hasError()) { - qDebug() << "XML error:" << xmlReader.errorString(); - return ErrorCode::IMAGE_L1DATA_XMLNAMEPARASEERROR; - } - - file.close(); - return ErrorCode::SUCCESS; -} - -std::shared_ptr SARSimulationImageL1Dataset::getAntPos() -{ - if (this->Rasterlevel == RasterLevel::RasterL2) { - return nullptr; - } - - - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - // ȡļ - std::shared_ptr rasterDataset = OpenDataset(this->GPSPointFilePath, GDALAccess::GA_ReadOnly); - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* demBand = rasterDataset->GetRasterBand(1); - - long width = rasterDataset->GetRasterXSize(); - long height = rasterDataset->GetRasterYSize(); - long band_num = rasterDataset->GetRasterCount(); - - std::shared_ptr temp = nullptr; - - if (gdal_datatype == GDT_Float64) { - temp = std::shared_ptr(new double[this->rowCount * 19], delArrPtr); - demBand->RasterIO(GF_Read, 0, 0, 19, this->rowCount, temp.get(), 19, this->rowCount, gdal_datatype, 0, 0); - } - else { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_GPSFILEFORMATERROR)); - } - rasterDataset.reset(); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - return temp; -} - -ErrorCode SARSimulationImageL1Dataset::saveAntPos(std::shared_ptr ptr) -{ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - // ȡļ - std::shared_ptr rasterDataset = OpenDataset(this->GPSPointFilePath, GDALAccess::GA_Update); - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* demBand = rasterDataset->GetRasterBand(1); - - long width = rasterDataset->GetRasterXSize(); - long height = rasterDataset->GetRasterYSize(); - long band_num = rasterDataset->GetRasterCount(); - - if (gdal_datatype == GDT_Float64) { - demBand->RasterIO(GF_Write, 0, 0, 19, this->rowCount, ptr.get(), 19, this->rowCount, gdal_datatype, 0, 0); - } - else { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_GPSFILEFORMATERROR)); - omp_unset_lock(&lock); - omp_destroy_lock(&lock); - return ErrorCode::ECHO_L0DATA_GPSFILEFORMATERROR; - } - rasterDataset.reset(); - omp_unset_lock(&lock); - omp_destroy_lock(&lock); - return ErrorCode::SUCCESS; -} - -std::shared_ptr> SARSimulationImageL1Dataset::getImageRaster() -{ - if (this->Rasterlevel != RasterLevel::RasterSLC) { - return nullptr; - } - - return this->getImageRaster(0, this->rowCount); -} - -ErrorCode SARSimulationImageL1Dataset::saveImageRaster(std::shared_ptr> echoPtr, long startPRF, long PRFLen) -{ - if (!(startPRF < this->rowCount)) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_PRFIDXOUTRANGE)); - return ErrorCode::ECHO_L0DATA_PRFIDXOUTRANGE; - } - else {} - - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - std::shared_ptr rasterDataset = OpenDataset(this->ImageRasterPath, GDALAccess::GA_Update); - - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* poBand = rasterDataset->GetRasterBand(1); - if (NULL == poBand || nullptr == poBand) { - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - return ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR; - } - else {} - long width = rasterDataset->GetRasterXSize(); - long height = rasterDataset->GetRasterYSize(); - long band_num = rasterDataset->GetRasterCount(); - - if (height != this->rowCount || width != this->colCount) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - return ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR; - } - else { - if (gdal_datatype == GDT_CFloat32) { - poBand->RasterIO(GF_Write, 0, startPRF, width, PRFLen, echoPtr.get(), width, PRFLen, GDT_CFloat32, 0, 0); - GDALFlushCache((GDALDatasetH)rasterDataset.get()); - } - else { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - } - } - rasterDataset.reset(); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - return ErrorCode::SUCCESS; -} - -std::shared_ptr> SARSimulationImageL1Dataset::getImageRaster(long startPRF, long PRFLen) -{ - if (this->Rasterlevel != RasterLevel::RasterSLC) { - return nullptr; - } - - - if (!(startPRF < this->rowCount)) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_PRFIDXOUTRANGE)) << startPRF << " " << this->rowCount; - return nullptr; - } - else {} - - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - std::shared_ptr rasterDataset = OpenDataset(this->ImageRasterPath, GDALAccess::GA_ReadOnly); - - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* poBand = rasterDataset->GetRasterBand(1); - if (NULL == poBand || nullptr == poBand) { - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - return nullptr; - } - else {} - long width = rasterDataset->GetRasterXSize(); - long height = rasterDataset->GetRasterYSize(); - long band_num = rasterDataset->GetRasterCount(); - std::shared_ptr> temp = nullptr; - if (height != this->rowCount || width != this->colCount) { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - } - else { - if (gdal_datatype == GDT_CFloat32) { - temp = std::shared_ptr>(new std::complex[PRFLen * width], delArrPtr); - poBand->RasterIO(GF_Read, 0, startPRF, width, PRFLen, temp.get(), width, PRFLen, GDT_CFloat32, 0, 0); - GDALFlushCache((GDALDatasetH)rasterDataset.get()); - } - else { - qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR)); - } - } - - rasterDataset.reset(); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - return temp; -} - -Eigen::MatrixXcd SARSimulationImageL1Dataset::getImageRasterMatrix() -{ - if (this->Rasterlevel != RasterLevel::RasterSLC) { - return Eigen::MatrixXcd::Zero(0,0); - } - - - std::shared_ptr> data = this->getImageRaster(); - Eigen::MatrixXcd dataimg = Eigen::MatrixXcd::Zero(this->rowCount, this->colCount); - for (long i = 0; i < this->rowCount; i++) { - for (long j = 0; j < this->colCount; j++) { - dataimg(i, j) = data.get()[i*colCount+j]; - } - } - return Eigen::MatrixXcd(); -} - -ErrorCode SARSimulationImageL1Dataset::saveImageRaster(Eigen::MatrixXcd& dataimg, long startPRF) -{ - std::shared_ptr> data(new std::complex[dataimg.rows()* dataimg.cols()]); - long dataimgrows = dataimg.rows(); - long dataimgcols = dataimg.cols(); - for (long i = 0; i < dataimgrows; i++) { - for (long j = 0; j < dataimgcols; j++) { - data.get()[i * dataimgcols + j] = dataimg(i, j); - } - } - this->saveImageRaster(data, startPRF,dataimgrows); - return ErrorCode(); -} - -gdalImage SARSimulationImageL1Dataset::getImageRasterGdalImage() -{ - return gdalImage(this->ImageRasterPath); -} - -void SARSimulationImageL1Dataset::setStartImageTime(double imageTime) -{ - this->startImageTime = imageTime; -} - -double SARSimulationImageL1Dataset::getStartImageTime() -{ - return this->startImageTime; -} - -void SARSimulationImageL1Dataset::setEndImageTime(double imageTime) -{ - this->EndImageTime = imageTime; -} - -double SARSimulationImageL1Dataset::getEndImageTime() -{ - return this->EndImageTime; -} - -QVector SARSimulationImageL1Dataset::getXmlSateAntPos() -{ - if (this->Rasterlevel == RasterLevel::RasterL2) { - return QVector(0); - } - return this->sateposes; -} - -void SARSimulationImageL1Dataset::setSateAntPos(QVector pos) -{ - this->sateposes = pos; -} - -// Getter Setter ʵ -long SARSimulationImageL1Dataset::getrowCount() { return this->rowCount; } -void SARSimulationImageL1Dataset::setrowCount(long rowCountin) { this->rowCount = rowCountin; } - -long SARSimulationImageL1Dataset::getcolCount() { return this->colCount; } -void SARSimulationImageL1Dataset::setcolCount(long pulsePointsin) { this->colCount = pulsePointsin; } - - -double SARSimulationImageL1Dataset::getNearRange() { return this->Rnear; } -void SARSimulationImageL1Dataset::setNearRange(double nearRange) { this->Rnear = nearRange; } - -double SARSimulationImageL1Dataset::getFarRange() { return this->Rfar; } -void SARSimulationImageL1Dataset::setFarRange(double farRange) { this->Rfar = farRange; } - -double SARSimulationImageL1Dataset::getRefRange() -{ - return this->Rref; -} - -void SARSimulationImageL1Dataset::setRefRange(double refRange) -{ - this->Rref = refRange; -} - -double SARSimulationImageL1Dataset::getCenterFreq() { return this->centerFreq; } -void SARSimulationImageL1Dataset::setCenterFreq(double freq) { this->centerFreq = freq; } - -double SARSimulationImageL1Dataset::getFs() { return this->Fs; } -void SARSimulationImageL1Dataset::setFs(double samplingFreq) { this->Fs = samplingFreq; } - -double SARSimulationImageL1Dataset::getPRF() -{ - return this->prf; -} - -void SARSimulationImageL1Dataset::setPRF(double PRF) -{ - this->prf = PRF; -} - -double SARSimulationImageL1Dataset::getCenterAngle() -{ - return this->CenterAngle; -} - -void SARSimulationImageL1Dataset::setCenterAngle(double angle) -{ - this->CenterAngle = angle; -} - -QString SARSimulationImageL1Dataset::getLookSide() -{ - return this->LookSide; -} - -void SARSimulationImageL1Dataset::setLookSide(QString looksides) -{ - this->LookSide = looksides; -} - -double SARSimulationImageL1Dataset::getTotalProcessedAzimuthBandWidth() -{ - return TotalProcessedAzimuthBandWidth; -} - -void SARSimulationImageL1Dataset::setTotalProcessedAzimuthBandWidth(double v) -{ - TotalProcessedAzimuthBandWidth = v; -} - -double SARSimulationImageL1Dataset::getDopplerParametersReferenceTime() -{ - return DopplerParametersReferenceTime; -} - -void SARSimulationImageL1Dataset::setDopplerParametersReferenceTime(double v) -{ - DopplerParametersReferenceTime = v; -} - -QVector SARSimulationImageL1Dataset::getDopplerParams() -{ - QVector result(5); - result[0] = d0; - result[1] = d1; - result[2] = d2; - result[3] = d3; - result[4] = d4; - - return result; -} - -void SARSimulationImageL1Dataset::setDopplerParams(double id0, double id1, double id2, double id3, double id4) -{ - this->d0 = id0; - this->d1 = id1; - this->d2 = id2; - this->d3 = id3; - this->d4 = id4; -} - -QVector SARSimulationImageL1Dataset::getDopplerCenterCoff() -{ - QVector result(5); - result[0] = r0; - result[1] = r1; - result[2] = r2; - result[3] = r3; - result[4] = r4; - - - return result; -} - -void SARSimulationImageL1Dataset::setDopplerCenterCoff(double ir0, double ir1, double ir2, double ir3, double ir4) -{ - this->r0 = ir0; - this->r1 = ir1; - this->r2 = ir2; - this->r3 = ir3; - this->r4 = ir4; -} - -double SARSimulationImageL1Dataset::getIncidenceAngleNearRange() -{ - return incidenceAngleNearRange; -} - -void SARSimulationImageL1Dataset::setIncidenceAngleNearRangeet(double angle) -{ - this->incidenceAngleNearRange = angle; -} - -double SARSimulationImageL1Dataset::getIncidenceAngleFarRange() -{ - return incidenceAngleFarRange; -} - -void SARSimulationImageL1Dataset::setIncidenceAngleFarRange(double angle) -{ - this->incidenceAngleFarRange = angle; -} - -double SARSimulationImageL1Dataset::getLatitudeCenter() { return latitude_center; } -void SARSimulationImageL1Dataset::setLatitudeCenter(double value) { latitude_center = value; } - -double SARSimulationImageL1Dataset::getLongitudeCenter() { return longitude_center; } -void SARSimulationImageL1Dataset::setLongitudeCenter(double value) { longitude_center = value; } - -double SARSimulationImageL1Dataset::getLatitudeTopLeft() { return latitude_topLeft; } -void SARSimulationImageL1Dataset::setLatitudeTopLeft(double value) { latitude_topLeft = value; } - -double SARSimulationImageL1Dataset::getLongitudeTopLeft() { return longitude_topLeft; } -void SARSimulationImageL1Dataset::setLongitudeTopLeft(double value) { longitude_topLeft = value; } - -double SARSimulationImageL1Dataset::getLatitudeTopRight() { return latitude_topRight; } -void SARSimulationImageL1Dataset::setLatitudeTopRight(double value) { latitude_topRight = value; } - -double SARSimulationImageL1Dataset::getLongitudeTopRight() { return longitude_topRight; } -void SARSimulationImageL1Dataset::setLongitudeTopRight(double value) { longitude_topRight = value; } - -double SARSimulationImageL1Dataset::getLatitudeBottomLeft() { return latitude_bottomLeft; } -void SARSimulationImageL1Dataset::setLatitudeBottomLeft(double value) { latitude_bottomLeft = value; } - -double SARSimulationImageL1Dataset::getLongitudeBottomLeft() { return longitude_bottomLeft; } -void SARSimulationImageL1Dataset::setLongitudeBottomLeft(double value) { longitude_bottomLeft = value; } - -double SARSimulationImageL1Dataset::getLatitudeBottomRight() { return latitude_bottomRight; } -void SARSimulationImageL1Dataset::setLatitudeBottomRight(double value) { latitude_bottomRight = value; } - -double SARSimulationImageL1Dataset::getLongitudeBottomRight() { return longitude_bottomRight; } -void SARSimulationImageL1Dataset::setLongitudeBottomRight(double value) { longitude_bottomRight = value; } - -double SARSimulationImageL1Dataset::getdrange() { return this->dr; } -void SARSimulationImageL1Dataset::setdrange(double idr) { this->dr = idr; } - -double SARSimulationImageL1Dataset::getdAz() { return this->dAz; } -void SARSimulationImageL1Dataset::setdAz(double idAz) { this->dAz = idAz; } - - - - -DemBox SARSimulationImageL1Dataset::getExtend() -{ - double minlon = 0, maxlon = 0; - double minlat = 0, maxlat = 0; - minlon = this->longitude_bottomLeft < this->longitude_bottomRight ? this->longitude_bottomLeft : this->longitude_bottomRight; - minlon = minlon < this->longitude_topLeft ? minlon : this->longitude_topLeft; - minlon = minlon < this->longitude_topRight ? minlon : this->longitude_topRight; - - minlat = this->latitude_bottomLeft < this->latitude_bottomRight ? this->latitude_bottomLeft : this->latitude_bottomRight; - minlat = minlat < this->latitude_topLeft ? minlat : this->latitude_topLeft; - minlat = minlat < this->latitude_bottomRight ? minlat : this->latitude_bottomRight; - - maxlon = this->longitude_bottomLeft > this->longitude_bottomRight ? this->longitude_bottomLeft : this->longitude_bottomRight; - maxlon = maxlon > this->longitude_topLeft ? maxlon : this->longitude_topLeft; - maxlon = maxlon > this->longitude_topRight ? maxlon : this->longitude_topRight; - - maxlat = this->latitude_bottomLeft > this->latitude_bottomRight ? this->latitude_bottomLeft : this->latitude_bottomRight; - maxlat = maxlat > this->latitude_topLeft ? maxlat : this->latitude_topLeft; - maxlat = maxlat > this->latitude_bottomRight ? maxlat : this->latitude_bottomRight; - - DemBox box; - box.min_lat = minlat; - box.min_lon = minlon; - box.max_lat = maxlat; - box.max_lon = maxlon; - - return box; -} diff --git a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h b/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h deleted file mode 100644 index 6d8325a..0000000 --- a/BaseCommonLibrary/BaseTool/SARSimulationImageL1.h +++ /dev/null @@ -1,218 +0,0 @@ -#pragma once - -#include "BaseConstVariable.h" - -#include "BaseTool.h" -#include "ImageOperatorBase.h" -#include "GeoOperator.h" -#include "FileOperator.h" -#include "LogInfoCls.h" - -enum RasterLevel { - RasterSLC, - RasterL1B, - RasterL2 -}; - -class BASECONSTVARIABLEAPI SARSimulationImageL1Dataset -{ -public: - SARSimulationImageL1Dataset(RasterLevel Rasterlevel= RasterLevel::RasterSLC); - ~SARSimulationImageL1Dataset(); - -private: - RasterLevel Rasterlevel; -public: - RasterLevel getRasterLevel(); - - -private : - QString outFolderPath; - QString L1DatasetName; - QString xmlfileName; - QString xmlFilePath; - QString ImageRasterName; - QString ImageRasterPath; - QString GPSPointFilename; - QString GPSPointFilePath; - -public: - QString getoutFolderPath(); - QString getDatesetName(); - QString getxmlfileName(); - QString getxmlFilePath(); - QString getImageRasterName(); - QString getImageRasterPath(); - QString getGPSPointFilename(); // GPS - QString getGPSPointFilePath(); - - -public: - ErrorCode OpenOrNew(QString folder, QString filename, long rowCount, long colCount); - ErrorCode Open(QString folderPath, QString Name); - ErrorCode Open(QString xmlPath); -public: - void saveToXml(); - ErrorCode loadFromXml(); - std::shared_ptr getAntPos(); - ErrorCode saveAntPos(std::shared_ptr ptr); // עΣգдǰǷȷ - - std::shared_ptr> getImageRaster(); - ErrorCode saveImageRaster(std::shared_ptr> echoPtr, long startPRF, long PRFLen); - std::shared_ptr> getImageRaster(long startPRF, long PRFLen); - - Eigen::MatrixXcd getImageRasterMatrix(); - ErrorCode saveImageRaster(Eigen::MatrixXcd& data, long startPRF); - - gdalImage getImageRasterGdalImage(); - -private: // xmlв - - long rowCount; - long colCount; - - double Rnear; - double Rfar; - double Rref; - - double centerFreq; - double Fs; - double prf; - - double CenterAngle; - QString LookSide; - QVector sateposes; - - double startImageTime; - double EndImageTime; - -public: - - void setStartImageTime(double imageTime); - double getStartImageTime(); - - void setEndImageTime(double imageTime); - double getEndImageTime(); - - - QVector getXmlSateAntPos(); - void setSateAntPos(QVector pos); - - long getrowCount(); - void setrowCount(long rowCount); - - long getcolCount(); - void setcolCount(long pulsePoints); - - double getNearRange(); - void setNearRange(double nearRange); - - double getFarRange(); - void setFarRange(double farRange); - - double getRefRange(); - void setRefRange(double refRange); - - double getCenterFreq(); - void setCenterFreq(double freq); - - double getFs(); - void setFs(double samplingFreq); - - double getPRF(); - void setPRF(double PRF); - - double getCenterAngle(); - void setCenterAngle(double angle); - - QString getLookSide(); - void setLookSide(QString lookside); - -public:// ղ - double TotalProcessedAzimuthBandWidth, DopplerParametersReferenceTime; - double d0, d1, d2, d3, d4; - double r0, r1, r2, r3, r4; - double DEM; - double incidenceAngleNearRange, incidenceAngleFarRange; - -public: - - double getTotalProcessedAzimuthBandWidth(); - void setTotalProcessedAzimuthBandWidth(double v); - - double getDopplerParametersReferenceTime(); - void setDopplerParametersReferenceTime(double v); - - // ղ - QVector getDopplerParams(); - void setDopplerParams(double d0, double d1, double d2, double d3, double d4); - - // ϵ - QVector getDopplerCenterCoff(); - void setDopplerCenterCoff(double r0, double r1, double r2, double r3, double r4); - - - double getIncidenceAngleNearRange(); - void setIncidenceAngleNearRangeet(double angle); - - double getIncidenceAngleFarRange(); - void setIncidenceAngleFarRange(double angle); - -private: - double latitude_center, longitude_center, - latitude_topLeft, longitude_topLeft, - latitude_topRight, longitude_topRight, - latitude_bottomLeft, longitude_bottomLeft, - latitude_bottomRight, longitude_bottomRight; -public: - // Getter and Setter functions - double getLatitudeCenter(); - void setLatitudeCenter(double value); - - double getLongitudeCenter(); - void setLongitudeCenter(double value); - - double getLatitudeTopLeft(); - void setLatitudeTopLeft(double value); - - double getLongitudeTopLeft(); - void setLongitudeTopLeft(double value); - - double getLatitudeTopRight(); - void setLatitudeTopRight(double value); - - double getLongitudeTopRight(); - void setLongitudeTopRight(double value); - - double getLatitudeBottomLeft(); - void setLatitudeBottomLeft(double value); - - double getLongitudeBottomLeft(); - void setLongitudeBottomLeft(double value); - - double getLatitudeBottomRight(); - void setLatitudeBottomRight(double value); - - double getLongitudeBottomRight(); - void setLongitudeBottomRight(double value); -public: - DemBox getExtend(); - - -public: - double getdrange(); - void setdrange(double dr); - - double getdAz(); - void setdAz(double dAz); -private: - double dr, dAz; - -}; - - - - - - - diff --git a/BaseCommonLibrary/BaseTool/ShowProessAbstract.cpp b/BaseCommonLibrary/BaseTool/ShowProessAbstract.cpp deleted file mode 100644 index e862722..0000000 --- a/BaseCommonLibrary/BaseTool/ShowProessAbstract.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "stdafx.h" -#include "ShowProessAbstract.h" -#include "BaseTool.h" -#include "GeoOperator.h" -#include "FileOperator.h" -#include - - -void ShowProessAbstract::showProcess(double precent, QString tip) -{ - -} - -void ShowProessAbstract::showToolInfo(QString tip) -{ -} - - diff --git a/BaseCommonLibrary/BaseTool/TestImageOperator.cpp b/BaseCommonLibrary/BaseTool/TestImageOperator.cpp deleted file mode 100644 index d2c9819..0000000 --- a/BaseCommonLibrary/BaseTool/TestImageOperator.cpp +++ /dev/null @@ -1,146 +0,0 @@ -#include "stdafx.h" -#include "ImageOperatorBase.h" -#include "BaseTool.h" -#include "GeoOperator.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "FileOperator.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include // OGRSpatialReference ڿռοת -#include // GDALWarp - - - -void testOutAmpArr(QString filename, float* amp, long rowcount, long colcount) -{ - - - Eigen::MatrixXd h_amp_img = Eigen::MatrixXd::Zero(rowcount, colcount); - - for (long hii = 0; hii < rowcount; hii++) { - for (long hjj = 0; hjj < colcount; hjj++) { - h_amp_img(hii, hjj) = amp[hii * colcount + hjj]; - } - } - QString ampPath = getDebugDataPath(filename); - saveEigenMatrixXd2Bin(h_amp_img, ampPath); - qDebug() << filename.toLocal8Bit().constData(); - qDebug() << "max:\t" << h_amp_img.maxCoeff(); - qDebug() << "min:\t" << h_amp_img.minCoeff(); -} - -void testOutAmpArr(QString filename, double* amp, long rowcount, long colcount) -{ - - - Eigen::MatrixXd h_amp_img = Eigen::MatrixXd::Zero(rowcount, colcount); - - for (long hii = 0; hii < rowcount; hii++) { - for (long hjj = 0; hjj < colcount; hjj++) { - h_amp_img(hii, hjj) = amp[hii * colcount + hjj]; - } - } - QString ampPath = getDebugDataPath(filename); - saveEigenMatrixXd2Bin(h_amp_img, ampPath); - qDebug() << filename.toLocal8Bit().constData(); - qDebug() << "max:\t" << h_amp_img.maxCoeff(); - qDebug() << "min:\t" << h_amp_img.minCoeff(); -} - - -void testOutClsArr(QString filename, long* amp, long rowcount, long colcount) { - - Eigen::MatrixXd h_amp_img = Eigen::MatrixXd::Zero(rowcount, colcount); - - for (long hii = 0; hii < rowcount; hii++) { - for (long hjj = 0; hjj < colcount; hjj++) { - h_amp_img(hii, hjj) = amp[hii * colcount + hjj]; - } - } - QString ampPath = getDebugDataPath(filename); - saveEigenMatrixXd2Bin(h_amp_img, ampPath); - qDebug() << filename.toLocal8Bit().constData(); - qDebug() << "max:\t" << h_amp_img.maxCoeff(); - qDebug() << "min:\t" << h_amp_img.minCoeff(); - -} - -void testOutComplexDoubleArr(QString filename, std::complex* data, long rowcount, long colcount) -{ - QString ampPath = getDebugDataPath(filename); - gdalImageComplex compleximg = CreateEchoComplex(ampPath, rowcount, colcount, 1); - compleximg.saveImage(data, 0, 0, rowcount, colcount, 1); - - return; -} - -void testOutDataArr(QString filename, double* data, long rowcount, long colcount) -{ - return testOutAmpArr(filename, data, rowcount, colcount); -} - -void testOutDataArr(QString filename, float* data, long rowcount, long colcount) -{ - return testOutAmpArr(filename, data, rowcount, colcount); -} - -void testOutDataArr(QString filename, long* data, long rowcount, long colcount) -{ - return testOutClsArr(filename, data, rowcount, colcount); -} - -void testOutAntPatternTrans(QString antpatternfilename, double* antPatternArr, - double starttheta, double deltetheta, - double startphi, double deltaphi, - long thetanum, long phinum) -{ - - - Eigen::MatrixXd antPatternMatrix(thetanum, phinum); - for (long t = 0; t < thetanum; ++t) { - for (long p = 0; p < phinum; ++p) { - long index = t * phinum + p; - if (index < thetanum * phinum) { - antPatternMatrix(t, p) = static_cast(antPatternArr[index]); // Copy to Eigen matrix - } - } - } - - Eigen::MatrixXd gt(2, 3); - gt(0, 0) = startphi;//x - gt(0, 1) = deltaphi; - gt(0, 2) = 0; - - gt(1, 0) = starttheta; - gt(1, 1) = 0; - gt(1, 2) = deltetheta; - - QString antpatternfilepath = getDebugDataPath(antpatternfilename); - gdalImage ds = CreategdalImageDouble(antpatternfilepath, thetanum, phinum, 1, gt, "", true, true, true); - ds.saveImage(antPatternMatrix, 0, 0, 1); -} - - - - - - diff --git a/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp b/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp deleted file mode 100644 index 7d0df86..0000000 --- a/BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp +++ /dev/null @@ -1,547 +0,0 @@ -#include "stdafx.h" -#include "ImageOperatorBase.h" -#include "BaseTool.h" -#include "GeoOperator.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "FileOperator.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include // OGRSpatialReference ڿռοת -#include // GDALWarp - - - - - - - - - -gdalImageComplex::gdalImageComplex(const QString& raster_path) -{ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - this->img_path = raster_path; - - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen( - raster_path.toUtf8().constData(), GA_ReadOnly)); - this->width = rasterDataset->GetRasterXSize(); - this->height = rasterDataset->GetRasterYSize(); - this->band_num = rasterDataset->GetRasterCount(); - - double* gt = new double[6]; - rasterDataset->GetGeoTransform(gt); - this->gt = Eigen::MatrixXd(2, 3); - this->gt << gt[0], gt[1], gt[2], gt[3], gt[4], gt[5]; - - double a = this->gt(0, 0); - double b = this->gt(0, 1); - double c = this->gt(0, 2); - double d = this->gt(1, 0); - double e = this->gt(1, 1); - double f = this->gt(1, 2); - - this->projection = rasterDataset->GetProjectionRef(); - - // ͷͶӰ - GDALFlushCache((GDALDatasetH)rasterDataset); - GDALClose((GDALDatasetH)rasterDataset); - rasterDataset = NULL; // ָÿ� - this->InitInv_gt(); - delete[] gt; - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - omp_unset_lock(&lock); // �ͷŻ�� - omp_destroy_lock(&lock); // ٻ�� -} - -gdalImageComplex::~gdalImageComplex() {} - -void gdalImageComplex::setData(Eigen::MatrixXcd data) -{ - this->data = data; -} - -void gdalImageComplex::saveImage(Eigen::MatrixXcd data, int start_row, int start_col, int band_ids) -{ - - - - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - if (start_row + data.rows() > this->height || start_col + data.cols() > this->width) { - QString tip = u8"file path: " + this->img_path; - qDebug() << tip; - throw std::exception(tip.toUtf8().constData()); - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - GDALDataset* poDstDS = nullptr; - if (exists_test(this->img_path)) { - poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update)); - } - else { - poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height, - this->band_num, GDT_CFloat64, NULL); // ��� - poDstDS->SetProjection(this->projection.toUtf8().constData()); - - double gt_ptr[6]; - for (int i = 0; i < this->gt.rows(); i++) { - for (int j = 0; j < this->gt.cols(); j++) { - gt_ptr[i * 3 + j] = this->gt(i, j); - } - } - poDstDS->SetGeoTransform(gt_ptr); - //delete[] gt_ptr; - } - - int datarows = data.rows(); - int datacols = data.cols(); - - if (this->getDataType() == GDT_CFloat64) - { - - double* databuffer = new double[data.size() * 2]; - for (int i = 0; i < data.rows(); i++) { - for (int j = 0; j < data.cols(); j++) { - databuffer[i * data.cols() * 2 + j * 2] = data(i, j).real(); - databuffer[i * data.cols() * 2 + j * 2 + 1] = data(i, j).imag(); - } - } - - // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols, - // datarows, GDT_Float32,band_ids, num,0,0,0); - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, - databuffer, datacols, datarows, GDT_CFloat64, 0, 0); - GDALFlushCache(poDstDS); - delete databuffer; - - } - else if (this->getDataType() == GDT_CFloat32) { - - float* databuffer = new float[data.size() * 2]; - for (int i = 0; i < data.rows(); i++) { - for (int j = 0; j < data.cols(); j++) { - databuffer[i * data.cols() * 2 + j * 2] = float(data(i, j).real()); - databuffer[i * data.cols() * 2 + j * 2 + 1] =float( data(i, j).imag()); - } - } - - // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols, - // datarows, GDT_Float32,band_ids, num,0,0,0); - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, - databuffer, datacols, datarows, GDT_CFloat32, 0, 0); - GDALFlushCache(poDstDS); - delete databuffer; - } - else { - throw std::exception("gdalImageComplex::saveImage: data type error"); - } - - - - GDALClose((GDALDatasetH)poDstDS); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // -} - -void gdalImageComplex::saveImage(std::shared_ptr> data, long start_row, long start_col, long rowCount, long colCount, int band_ids) -{ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - if (start_row + rowCount > this->height || start_col + colCount > this->width) { - QString tip = u8"file path: " + this->img_path; - qDebug() << tip; - throw std::exception(tip.toUtf8().constData()); - return; - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - GDALDataset* poDstDS = nullptr; - if (exists_test(this->img_path)) { - poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update)); - } - else { - poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height, - this->band_num, GDT_CFloat64, NULL); // ��� - poDstDS->SetProjection(this->projection.toUtf8().constData()); - - double gt_ptr[6]; - for (int i = 0; i < this->gt.rows(); i++) { - for (int j = 0; j < this->gt.cols(); j++) { - gt_ptr[i * 3 + j] = this->gt(i, j); - } - } - poDstDS->SetGeoTransform(gt_ptr); - //delete[] gt_ptr; - } - - double* databuffer = new double[rowCount * colCount * 2]; - for (long i = 0; i < rowCount; i++) { - for (long j = 0; j < colCount; j++) { - databuffer[i * colCount * 2 + j * 2] = data.get()[i * colCount + j].real(); - databuffer[i * colCount * 2 + j * 2 + 1] = data.get()[i * colCount + j].imag(); - } - } - - // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols, - // datarows, GDT_Float32,band_ids, num,0,0,0); - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, colCount, rowCount, - databuffer, colCount, rowCount, GDT_CFloat64, 0, 0); - GDALFlushCache(poDstDS); - delete databuffer; - GDALClose((GDALDatasetH)poDstDS); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - -} - -void gdalImageComplex::saveImage(std::complex* data, long start_row, long start_col, long rowCount, long colCount, int band_ids) -{ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - if (start_row + rowCount > this->height || start_col + colCount > this->width) { - QString tip = u8"file path: " + this->img_path; - qDebug() << tip; - throw std::exception(tip.toUtf8().constData()); - return; - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - GDALDataset* poDstDS = nullptr; - if (exists_test(this->img_path)) { - poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update)); - } - else { - poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height, - this->band_num, GDT_CFloat64, NULL); // ��� - poDstDS->SetProjection(this->projection.toUtf8().constData()); - - double gt_ptr[6]; - for (int i = 0; i < this->gt.rows(); i++) { - for (int j = 0; j < this->gt.cols(); j++) { - gt_ptr[i * 3 + j] = this->gt(i, j); - } - } - poDstDS->SetGeoTransform(gt_ptr); - //delete[] gt_ptr; - } - - double* databuffer = new double[rowCount * colCount * 2]; - for (long i = 0; i < rowCount; i++) { - for (long j = 0; j < colCount; j++) { - databuffer[i * colCount * 2 + j * 2] = data[i * colCount + j].real(); - databuffer[i * colCount * 2 + j * 2 + 1] = data[i * colCount + j].imag(); - } - } - - // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols, - // datarows, GDT_Float32,band_ids, num,0,0,0); - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, colCount, rowCount, - databuffer, colCount, rowCount, GDT_CFloat64, 0, 0); - GDALFlushCache(poDstDS); - delete databuffer; - GDALClose((GDALDatasetH)poDstDS); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // -} - -Eigen::MatrixXcd gdalImageComplex::getDataComplex(int start_row, int start_col, int rows_count, - int cols_count, int band_ids) -{ - GDALDataset* poDataset; - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - // TIFFļ - poDataset = (GDALDataset*)GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly); - if (poDataset == nullptr) { - QMessageBox::warning(nullptr, u8"", u8"޷ļ" + this->img_path); - qDebug() << u8"޷ļ" + this->img_path; - } - - // ȡݼĵһ - GDALRasterBand* poBand; - poBand = poDataset->GetRasterBand(1); - rows_count = start_row + rows_count <= this->height ? rows_count : this->height - start_row; - cols_count = start_col + cols_count <= this->width ? cols_count : this->width - start_col; - // ȡϢǸ - int nXSize = cols_count; poBand->GetXSize(); - int nYSize = rows_count; poBand->GetYSize(); - Eigen::MatrixXcd rasterData(nYSize, nXSize); // ʹEigenMatrixXcd - if (this->getDataType() == GDT_CFloat64) - { - long long pixelCount =long long( nXSize) *long long( nYSize); - double* databuffer = new double[pixelCount * 2]; - poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count, rows_count, GDT_CFloat64, 0, 0); - GDALClose((GDALDatasetH)poDataset); - - for (long long i = 0; i < nYSize; i++) { - for (long long j = 0; j < nXSize; j++) { - rasterData(i, j) = std::complex(databuffer[i * nXSize * 2 + j * 2], - databuffer[i * nXSize * 2 + j * 2 + 1]); - } - } - - delete[] databuffer; - } - else if(this->getDataType()==GDT_CFloat32) - { - long long pixelCount = long long(nXSize) * long long(nYSize); - float* databuffer = new float[pixelCount * 2]; - poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count, rows_count, GDT_CFloat32, 0, 0); - GDALClose((GDALDatasetH)poDataset); - - for (long long i = 0; i < nYSize; i++) { - for (long long j = 0; j < nXSize; j++) { - rasterData(i, j) = std::complex(databuffer[i * nXSize * 2 + j * 2], - databuffer[i * nXSize * 2 + j * 2 + 1]); - } - } - - delete[] databuffer; - } - - - return rasterData; -} - -std::shared_ptr> gdalImageComplex::getDataComplexSharePtr(int start_row, int start_col, int rows_count, int cols_count, int band_ids) -{ - GDALDataset* poDataset; - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - // TIFFļ - poDataset = (GDALDataset*)GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly); - if (poDataset == nullptr) { - QMessageBox::warning(nullptr, u8"", u8"޷ļ" + this->img_path); - qDebug() << u8"޷ļ" + this->img_path; - } - - // ȡݼĵһ - GDALRasterBand* poBand; - poBand = poDataset->GetRasterBand(1); - - // ȡϢǸ - - - double* databuffer = new double[rows_count * cols_count * 2]; - poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count, - rows_count, GDT_CFloat64, 0, 0); - GDALClose((GDALDatasetH)poDataset); - - std::shared_ptr> rasterData(new std::complex[rows_count * cols_count], delArrPtr); - - for (size_t i = 0; i < rows_count; i++) { - for (size_t j = 0; j < cols_count; j++) { - rasterData.get()[i * cols_count + j] = std::complex(databuffer[i * cols_count * 2 + j * 2], - databuffer[i * cols_count * 2 + j * 2 + 1]); - } - } - - delete[] databuffer; - return rasterData; -} - -void gdalImageComplex::saveComplexImage() -{ - this->saveImage(this->data, this->start_row, this->start_col, this->data_band_ids); -} -void gdalImageComplex::savePreViewImage() -{ - qDebug() << "void gdalImageComplex::savePreViewImage()"; - Eigen::MatrixXd data_abs = Eigen::MatrixXd::Zero(this->height, this->width); - data_abs = (this->data.array().real().pow(2) + this->data.array().imag().pow(2)) - .array() - .log10() * 10.0; // - - double min_abs = data_abs.minCoeff(); // ֵ - double max_abs = data_abs.maxCoeff(); // Сֵ - double delta = (max_abs - min_abs) / 1000; // 1000λ - Eigen::MatrixX data_idx = - ((data_abs.array() - min_abs).array() / delta).array().floor().cast(); - - // ʼ - double hist[1001]; - for (size_t i = 0; i < 1001; i++) { - hist[i] = 0; // ʼ - } - for (size_t i = 0; i < this->height; i++) { - for (size_t j = 0; j < this->width; j++) { - hist[data_idx(i, j)]++; - } - } - - // ͳ - size_t count = this->height * this->width; - double precent = 0; - size_t curCount = 0; - double pre2 = 0; - bool findprec_2 = true; - double pre98 = 0; - bool findprec_98 = true; - for (size_t i = 0; i < 1001; i++) { - precent = precent + hist[i]; - if (findprec_2 & precent / count > 0.02) { - pre2 = i * delta + min_abs; - findprec_2 = false; - } - if (findprec_98 & precent / count > 0.98) { - pre98 = (i - 1) * delta + min_abs; - findprec_98 = false; - } - } - // - delta = (pre98 - pre2) / 200; - data_idx = - ((data_abs.array() - pre2).array() / delta).array().floor().cast(); - - for (size_t i = 0; i < this->height; i++) { - for (size_t j = 0; j < this->width; j++) { - if (data_idx(i, j) < 0) { - data_idx(i, j) = 0; - } - else if (data_idx(i, j) > 255) { - data_idx(i, j) = 255; - } - else { - - } - } - } - - // ֵ - QString filePath = this->img_path; - QFile file(filePath); - QFileInfo fileInfo(file); - - QString directory = fileInfo.absolutePath(); - qDebug() << "ļĿ¼" << directory; - QString baseName = fileInfo.completeBaseName(); - qDebug() << "޺׺ļ" << baseName; - - // ļ· - QString previewImagePath = JoinPath(directory, baseName + "_preview.png"); - cv::Mat img(this->height, this->width, CV_8U, cv::Scalar(0)); - - for (size_t i = 0; i < this->height; i++) { - for (size_t j = 0; j < this->width; j++) { - img.at(i, j) = (uchar)(data_idx(i, j)); - } - } - //std::string outimgpath=previewImagePath.toUtf8().data(); - cv::imwrite(previewImagePath.toUtf8().data(), img); -} - - - -gdalImageComplex CreategdalImageComplex(const QString& img_path, int height, int width, - int band_num, Eigen::MatrixXd gt, QString projection, - bool need_gt, bool overwrite) -{ - if (exists_test(img_path.toUtf8().constData())) { - if (overwrite) { - gdalImageComplex result_img(img_path); - return result_img; - } - else { - throw "file has exist!!!"; - exit(1); - } - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - GDALDataset* poDstDS = poDriver->Create(img_path.toUtf8().constData(), width, height, band_num, - GDT_CFloat64, NULL); - if (need_gt) { - poDstDS->SetProjection(projection.toUtf8().constData()); - - // ����ת������ - double gt_ptr[6] = { 0 }; - for (int i = 0; i < gt.rows(); i++) { - for (int j = 0; j < gt.cols(); j++) { - gt_ptr[i * 3 + j] = gt(i, j); - } - } - poDstDS->SetGeoTransform(gt_ptr); - } - //for(int i = 1; i <= band_num; i++) { - // poDstDS->GetRasterBand(i)->SetNoDataValue(0); // ز - //} - GDALFlushCache((GDALDatasetH)poDstDS); - GDALClose((GDALDatasetH)poDstDS); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - gdalImageComplex result_img(img_path); - return result_img; -} - -gdalImageComplex CreategdalImageComplexNoProj(const QString& img_path, int height, int width, int band_num, bool overwrite) -{ - - // ļ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - GDALDataset* poDstDS = (poDriver->Create(img_path.toUtf8().constData(), width, height, band_num, GDT_CFloat64, NULL)); - GDALFlushCache((GDALDatasetH)poDstDS); - GDALClose((GDALDatasetH)poDstDS); - //poDstDS.reset(); - omp_unset_lock(&lock); // - omp_destroy_lock(&lock); // - - gdalImageComplex result_img(img_path); - return result_img; -} - -gdalImageComplex CreateEchoComplex(const QString& img_path, int height, int width, int band_num) -{ - // ͼ - Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3); - //Xgeo = GeoTransform[0] + Xpixel * GeoTransform[1] + Ypixel * GeoTransform[2] - //Ygeo = GeoTransform[3] + Xpixel * GeoTransform[4] + Ypixel * GeoTransform[5] - // X - gt(0, 0) = 0; gt(0, 2) = 1; gt(0, 2) = 0; - gt(1, 0) = 0; gt(1, 1) = 0; gt(1, 2) = 1; - // Y - QString projection = ""; - gdalImageComplex echodata = CreategdalImageComplex(img_path, height, width, 1, gt, projection, false, true); - return echodata; - -} - diff --git a/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp b/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp deleted file mode 100644 index 9fe8bfd..0000000 --- a/BaseCommonLibrary/BaseTool/gdalImageOperator.cpp +++ /dev/null @@ -1,1530 +0,0 @@ -#include "stdafx.h" -#include "ImageOperatorBase.h" -#include "BaseTool.h" -#include "GeoOperator.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "FileOperator.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include // OGRSpatialReference ڿռοת -#include // GDALWarp - - - - - -gdalImage::gdalImage() -{ - this->height = 0; - this->width = 0; - this->data_band_ids = 1; - this->start_row = 0; - this->start_col = 0; -} - -/// -/// �ͼȡӰ�?1?7 -/// -/// -gdalImage::gdalImage(const QString& raster_path) -{ - omp_lock_t lock; - omp_init_lock(&lock); // ��ʼ�� - omp_set_lock(&lock); // ��û�?1?7 - this->img_path = raster_path; - - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // עʽ��?1?7 - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - // ��DEMӰ�� - GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(raster_path.toUtf8().constData(), GA_ReadOnly)); - if (nullptr == rasterDataset || NULL == rasterDataset) { - QMessageBox::warning(nullptr, u8"", QString(u8"ļ޷򿪣") + QString(raster_path)); - exit(1); - } - this->width = rasterDataset->GetRasterXSize(); - this->height = rasterDataset->GetRasterYSize(); - this->band_num = rasterDataset->GetRasterCount(); - - double* gt = new double[6]; - // ��÷��� - rasterDataset->GetGeoTransform(gt); - this->gt = Eigen::MatrixXd(2, 3); - this->gt << gt[0], gt[1], gt[2], gt[3], gt[4], gt[5]; - - this->projection = rasterDataset->GetProjectionRef(); - // �� - // double* inv_gt = new double[6];; - // GDALInvGeoTransform(gt, inv_gt); // �� - // �ͶӰ - GDALFlushCache((GDALDatasetH)rasterDataset); - GDALClose((GDALDatasetH)rasterDataset); - rasterDataset = NULL; // ָÿ� - this->InitInv_gt(); - delete[] gt; - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - omp_unset_lock(&lock); // �ͷŻ�� - omp_destroy_lock(&lock); // ٻ�� -} - -gdalImage::~gdalImage() {} - -void gdalImage::setHeight(int height) -{ - this->height = height; -} - -void gdalImage::setWidth(int width) -{ - this->width = width; -} - -void gdalImage::setTranslationMatrix(Eigen::MatrixXd gt) -{ - this->gt = gt; -} - -void gdalImage::setData(Eigen::MatrixXd, int data_band_ids) -{ - this->data = data; - this->data_band_ids = data_band_ids; -} - -Eigen::MatrixXd gdalImage::getData(int start_row, int start_col, int rows_count, int cols_count, - int band_ids = 1) -{ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen( - this->img_path.toUtf8().constData(), GA_ReadOnly)); // ��ֻ�ʽ��ȡ�Ӱ�� - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* demBand = rasterDataset->GetRasterBand(band_ids); - - rows_count = start_row + rows_count <= this->height ? rows_count : this->height - start_row; - cols_count = start_col + cols_count <= this->width ? cols_count : this->width - start_col; - - Eigen::MatrixXd datamatrix(rows_count, cols_count); - - if (gdal_datatype == GDT_Byte) { - char* temp = new char[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = long(temp[i * cols_count + j]) * 1.0; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_UInt16) { - unsigned short* temp = new unsigned short[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = long(temp[i * cols_count + j]) * 1.0; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_Int16) { - short* temp = new short[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = long(temp[i * cols_count + j]) * 1.0; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_UInt32) { - unsigned int* temp = new unsigned int[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_Int32) { - int* temp = new int[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = long(temp[i * cols_count + j]) * 1.0; - } - } - delete[] temp; - } - //else if (gdal_datatype == GDT_UInt64) { - // unsigned long* temp = new unsigned long[rows_count * cols_count]; - // demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - // rows_count, gdal_datatype, 0, 0); for (int i = 0; i < rows_count; i++) { - // for (int j = 0; j < - // cols_count; j++) { - // datamatrix(i, j) = temp[i * cols_count + j]; - // } - // } - // delete[] temp; - //} - //else if (gdal_datatype == GDT_Int64) { - // long* temp = new long[rows_count * cols_count]; - // demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - // rows_count, gdal_datatype, 0, 0); for (int i = 0; i < rows_count; i++) { - // for (int j = 0; j < - // cols_count; j++) { - // datamatrix(i, j) = temp[i * cols_count + j]; - // } - // } - // delete[] temp; - //} - else if (gdal_datatype == GDT_Float32) { - float* temp = new float[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_Float64) { - double* temp = new double[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else { - } - GDALClose((GDALDatasetH)rasterDataset); - omp_unset_lock(&lock); // �ͷŻ�� - omp_destroy_lock(&lock); // ٻ�� - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - return datamatrix; -} - -Eigen::MatrixXf gdalImage::getDataf(int start_row, int start_col, int rows_count, int cols_count, - int band_ids = 1) -{ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen( - this->img_path.toUtf8().constData(), GA_ReadOnly)); // ��ֻ�ʽ��ȡ�Ӱ�� - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* demBand = rasterDataset->GetRasterBand(band_ids); - - rows_count = start_row + rows_count <= this->height ? rows_count : this->height - start_row; - cols_count = start_col + cols_count <= this->width ? cols_count : this->width - start_col; - - Eigen::MatrixXf datamatrix(rows_count, cols_count); - - if (gdal_datatype == GDT_Byte) { - char* temp = new char[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_UInt16) { - unsigned short* temp = new unsigned short[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_Int16) { - short* temp = new short[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_UInt32) { - unsigned int* temp = new unsigned int[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_Int32) { - int* temp = new int[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - //else if (gdal_datatype == GDT_UInt64) { - // unsigned long* temp = new unsigned long[rows_count * cols_count]; - // demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - // rows_count, gdal_datatype, 0, 0); for (int i = 0; i < rows_count; i++) { - // for (int j = 0; j < - // cols_count; j++) { - // datamatrix(i, j) = temp[i * cols_count + j]; - // } - // } - // delete[] temp; - //} - //else if (gdal_datatype == GDT_Int64) { - // long* temp = new long[rows_count * cols_count]; - // demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - // rows_count, gdal_datatype, 0, 0); for (int i = 0; i < rows_count; i++) { - // for (int j = 0; j < - // cols_count; j++) { - // datamatrix(i, j) = temp[i * cols_count + j]; - // } - // } - // delete[] temp; - //} - else if (gdal_datatype == GDT_Float32) { - float* temp = new float[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_Float64) { - double* temp = new double[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else { - } - GDALClose((GDALDatasetH)rasterDataset); - omp_unset_lock(&lock); // �ͷŻ�� - omp_destroy_lock(&lock); // ٻ�� - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - return datamatrix; -} - - - -Eigen::MatrixXi gdalImage::getDatai(int start_row, int start_col, int rows_count, int cols_count, int band_ids) -{ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen( - this->img_path.toUtf8().constData(), GA_ReadOnly)); // ��ֻ�ʽ��ȡ�Ӱ�� - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* demBand = rasterDataset->GetRasterBand(band_ids); - - rows_count = start_row + rows_count <= this->height ? rows_count : this->height - start_row; - cols_count = start_col + cols_count <= this->width ? cols_count : this->width - start_col; - - Eigen::MatrixXi datamatrix(rows_count, cols_count); - - if (gdal_datatype == GDT_Byte) { - char* temp = new char[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_UInt16) { - unsigned short* temp = new unsigned short[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_Int16) { - short* temp = new short[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_UInt32) { - unsigned int* temp = new unsigned int[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_Int32) { - int* temp = new int[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - //else if (gdal_datatype == GDT_UInt64) { - // unsigned long* temp = new unsigned long[rows_count * cols_count]; - // demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - // rows_count, gdal_datatype, 0, 0); for (int i = 0; i < rows_count; i++) { - // for (int j = 0; j < - // cols_count; j++) { - // datamatrix(i, j) = temp[i * cols_count + j]; - // } - // } - // delete[] temp; - //} - //else if (gdal_datatype == GDT_Int64) { - // long* temp = new long[rows_count * cols_count]; - // demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, rows_count, gdal_datatype, 0, 0); - // for (int i = 0; i < rows_count; i++) { - // for (int j = 0; j < cols_count; j++) { - // datamatrix(i, j) = temp[i * cols_count + j]; - // } - // } - // delete[] temp; - //} - else if (gdal_datatype == GDT_Float32) { - float* temp = new float[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else if (gdal_datatype == GDT_Float64) { - double* temp = new double[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, cols_count, - rows_count, gdal_datatype, 0, 0); - - for (int i = 0; i < rows_count; i++) { - for (int j = 0; j < cols_count; j++) { - datamatrix(i, j) = temp[i * cols_count + j]; - } - } - delete[] temp; - } - else { - } - GDALClose((GDALDatasetH)rasterDataset); - omp_unset_lock(&lock); // �ͷŻ�� - omp_destroy_lock(&lock); // ٻ�� - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - return datamatrix; -} - -ErrorCode gdalImage::getData(double* data, int start_row, int start_col, int rows_count, int cols_count, int band_ids) -{ - ErrorCode state = ErrorCode::SUCCESS; - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly)); // ��ֻ�ʽ��ȡ�Ӱ�� - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* demBand = rasterDataset->GetRasterBand(band_ids); - - rows_count = start_row + rows_count <= this->height ? rows_count : this->height - start_row; - cols_count = start_col + cols_count <= this->width ? cols_count : this->width - start_col; - - - - if (gdal_datatype == GDT_Float64) { - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, data, cols_count, rows_count, gdal_datatype, 0, 0); - } - else { - state = ErrorCode::FAIL; - } - GDALClose((GDALDatasetH)rasterDataset); - omp_unset_lock(&lock); // �ͷŻ�� - omp_destroy_lock(&lock); // ٻ�� - return state; -} - -ErrorCode gdalImage::getData(long* data, int start_row, int start_col, int rows_count, int cols_count, int band_ids) -{ - ErrorCode state = ErrorCode::SUCCESS; - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly)); // ��ֻ�ʽ��ȡ�Ӱ�� - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* demBand = rasterDataset->GetRasterBand(band_ids); - - rows_count = start_row + rows_count <= this->height ? rows_count : this->height - start_row; - cols_count = start_col + cols_count <= this->width ? cols_count : this->width - start_col; - - if (gdal_datatype == GDT_Int32) { - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, data, cols_count, rows_count, gdal_datatype, 0, 0); - } - else { - state = ErrorCode::FAIL; - } - GDALClose((GDALDatasetH)rasterDataset); - omp_unset_lock(&lock); // �ͷŻ�� - omp_destroy_lock(&lock); // ٻ�� - return state; -} - -Eigen::MatrixXd gdalImage::getGeoTranslation() -{ - return this->gt; -} - -GDALDataType gdalImage::getDataType() -{ - GDALDataset* rasterDataset = - (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly)); - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - return gdal_datatype; -} - -/// -/// -/// -/// -/// -/// -/// -void gdalImage::saveImage(Eigen::MatrixXd data, int start_row = 0, int start_col = 0, - int band_ids = 1) -{ - GDALDataType datetype = this->getDataType(); - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - if (start_row + data.rows() > this->height || start_col + data.cols() > this->width) { - QString tip = u8"file path: " + this->img_path + " image size :( " + QString::number(this->height) + " , " + QString::number(this->width) + " ) " + " input size (" + QString::number(start_row + data.rows()) + ", " + QString::number(start_col + data.cols()) + ") "; - qDebug() << tip; - throw std::exception(tip.toUtf8().constData()); - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - QString filesuffer = getFileExtension(this->img_path).toLower(); - bool isTiff = filesuffer.contains("tif"); - GDALDriver* poDriver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI"); - GDALDataset* poDstDS = nullptr; - if (exists_test(this->img_path)) { - poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update)); - } - else { - poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height, - this->band_num, datetype, NULL); // ��� - - if (nullptr == poDstDS) { - QString tip = u8"file path: " + this->img_path + " image size :( " + QString::number(this->height) + " , " + QString::number(this->width) + " ) " + " input size (" + QString::number(start_row + data.rows()) + ", " + QString::number(start_col + data.cols()) + ") "; - qDebug() << tip; - throw std::exception(tip.toUtf8().constData()); - return; - } - - poDstDS->SetProjection(this->projection.toUtf8().constData()); - - double gt_ptr[6]; - for (int i = 0; i < this->gt.rows(); i++) { - for (int j = 0; j < this->gt.cols(); j++) { - gt_ptr[i * 3 + j] = this->gt(i, j); - } - } - poDstDS->SetGeoTransform(gt_ptr); - //delete gt_ptr; - } - - - int datarows = data.rows(); - int datacols = data.cols(); - void* databuffer = nullptr; - if (datetype == GDT_Float32) { - databuffer = new float[datarows * datacols]; - for (int i = 0; i < datarows; i++) { - for (int j = 0; j < datacols; j++) { - ((float*)databuffer)[i * datacols + j] = float(data(i, j)); - } - } - - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, - databuffer, datacols, datarows, datetype, 0, 0); - } - else if (datetype == GDT_Float64) { - databuffer = new double[datarows * datacols]; - for (int i = 0; i < datarows; i++) { - for (int j = 0; j < datacols; j++) { - ((double*)databuffer)[i * datacols + j] = double(data(i, j)); - } - } - - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, - databuffer, datacols, datarows, datetype, 0, 0); - } - else { - - } - GDALFlushCache(poDstDS); - GDALClose((GDALDatasetH)poDstDS); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - delete[] databuffer; - omp_unset_lock(&lock); // �ͷŻ�� - omp_destroy_lock(&lock); // ٻ�� -} - -void gdalImage::saveImage(Eigen::MatrixXf data, int start_row = 0, int start_col = 0, - int band_ids = 1) -{ - GDALDataType datetype = this->getDataType(); - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - if (start_row + data.rows() > this->height || start_col + data.cols() > this->width) { - QString tip = u8"file path: " + this->img_path + " image size :( " + QString::number(this->height) + " , " + QString::number(this->width) + " ) " + " input size (" + QString::number(start_row + data.rows()) + ", " + QString::number(start_col + data.cols()) + ") "; - qDebug() << tip; - throw std::exception(tip.toUtf8().constData()); - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - QString filesuffer = getFileExtension(this->img_path).toLower(); - bool isTiff = filesuffer.contains("tif"); - GDALDriver* poDriver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI"); - GDALDataset* poDstDS = nullptr; - if (exists_test(this->img_path)) { - poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update)); - } - else { - poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height, - this->band_num, datetype, NULL); // ��� - - if (nullptr == poDstDS) { - QString tip = u8"file path: " + this->img_path + " image size :( " + QString::number(this->height) + " , " + QString::number(this->width) + " ) " + " input size (" + QString::number(start_row + data.rows()) + ", " + QString::number(start_col + data.cols()) + ") "; - qDebug() << tip; - throw std::exception(tip.toUtf8().constData()); - return; - } - - poDstDS->SetProjection(this->projection.toUtf8().constData()); - - double gt_ptr[6]; - for (int i = 0; i < this->gt.rows(); i++) { - for (int j = 0; j < this->gt.cols(); j++) { - gt_ptr[i * 3 + j] = this->gt(i, j); - } - } - poDstDS->SetGeoTransform(gt_ptr); - //delete gt_ptr; - } - - - int datarows = data.rows(); - int datacols = data.cols(); - void* databuffer = nullptr; - if (datetype == GDT_Float32) { - databuffer = new float[datarows * datacols]; - for (int i = 0; i < datarows; i++) { - for (int j = 0; j < datacols; j++) { - ((float*)databuffer)[i * datacols + j] = float(data(i, j)); - } - } - - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, - databuffer, datacols, datarows, datetype, 0, 0); - } - else if (datetype == GDT_Float64) { - databuffer = new double[datarows * datacols]; - for (int i = 0; i < datarows; i++) { - for (int j = 0; j < datacols; j++) { - ((double*)databuffer)[i * datacols + j] = double(data(i, j)); - } - } - - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, - databuffer, datacols, datarows, datetype, 0, 0); - } - else { - - } - GDALFlushCache(poDstDS); - GDALClose((GDALDatasetH)poDstDS); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - delete[] databuffer; - omp_unset_lock(&lock); // �ͷŻ�� - omp_destroy_lock(&lock); // ٻ�� -} - - -void gdalImage::saveImage(Eigen::MatrixXi data, int start_row, int start_col, int band_ids) -{ - GDALDataType datetype = this->getDataType(); - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - if (start_row + data.rows() > this->height || start_col + data.cols() > this->width) { - QString tip = u8"file path: " + this->img_path + " image size :( " + QString::number(this->height) + " , " + QString::number(this->width) + " ) " + " input size (" + QString::number(start_row + data.rows()) + ", " + QString::number(start_col + data.cols()) + ") "; - qDebug() << tip; - throw std::exception(tip.toUtf8().constData()); - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - QString filesuffer = getFileExtension(this->img_path).toLower(); - bool isTiff = filesuffer.contains("tif"); - GDALDriver* poDriver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI"); - GDALDataset* poDstDS = nullptr; - if (exists_test(this->img_path)) { - poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update)); - } - else { - poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height, - this->band_num, GDT_Float32, NULL); // ��� - poDstDS->SetProjection(this->projection.toUtf8().constData()); - - double gt_ptr[6]; - for (int i = 0; i < this->gt.rows(); i++) { - for (int j = 0; j < this->gt.cols(); j++) { - gt_ptr[i * 3 + j] = this->gt(i, j); - } - } - poDstDS->SetGeoTransform(gt_ptr); - //delete gt_ptr; - } - - long datarows = data.rows(); - long datacols = data.cols(); - - long* databuffer = new long[datarows * datacols]; // (float*)malloc(datarows * datacols * sizeof(float)); - - for (long i = 0; i < datarows; i++) { - for (long j = 0; j < datacols; j++) { - databuffer[i * datacols + j] = data(i, j); - } - } - // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols, - // datarows, GDT_Float32,band_ids, num,0,0,0); - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, - databuffer, datacols, datarows, datetype, 0, 0); - - GDALFlushCache(poDstDS); - GDALClose((GDALDatasetH)poDstDS); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - delete[] databuffer; - omp_unset_lock(&lock); // �ͷŻ�� - omp_destroy_lock(&lock); // ٻ�� -} - -void gdalImage::saveImage(std::shared_ptr data, int start_row, int start_col, int rowcount, int colcount, int band_ids) -{ - GDALDataType datetype = this->getDataType(); - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - if (start_row + rowcount > this->height || start_col + colcount > this->width) { - QString tip = u8"file path: " + this->img_path + " image size :( " + QString::number(this->height) + " , " + QString::number(this->width) + " ) " + " input size (" + QString::number(start_row + rowcount) + ", " + QString::number(start_col + colcount) + ") "; - qDebug() << tip; - throw std::exception(tip.toUtf8().constData()); - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - QString filesuffer = getFileExtension(this->img_path).toLower(); - bool isTiff = filesuffer.contains("tif"); - GDALDriver* poDriver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI"); - GDALDataset* poDstDS = nullptr; - if (exists_test(this->img_path)) { - poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update)); - } - else { - poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height, - this->band_num, GDT_Float64, NULL); // ��� - poDstDS->SetProjection(this->projection.toUtf8().constData()); - - double gt_ptr[6]; - for (int i = 0; i < this->gt.rows(); i++) { - for (int j = 0; j < this->gt.cols(); j++) { - gt_ptr[i * 3 + j] = this->gt(i, j); - } - } - poDstDS->SetGeoTransform(gt_ptr); - } - - long datarows = rowcount; - long datacols = colcount; - double* databuffer = new double[datarows * datacols]; - if (datetype == GDT_Float64) { - memcpy(databuffer, data.get(), sizeof(double) * datarows * datacols); - } - else { - for (long i = 0; i < datarows; i++) { - for (long j = 0; j < datacols; j++) { - databuffer[i * datacols + j] = data.get()[i * datacols + j]; - } - } - } - - // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols, - // datarows, GDT_Float32,band_ids, num,0,0,0); - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, - databuffer, datacols, datarows, datetype, 0, 0); - - GDALFlushCache(poDstDS); - GDALClose((GDALDatasetH)poDstDS); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - delete[] databuffer; - omp_unset_lock(&lock); // �ͷŻ�� - omp_destroy_lock(&lock); // ٻ�� -} - -void gdalImage::saveImage(std::shared_ptr data, int start_row, int start_col, int rowcount, int colcount, int band_ids) -{ - GDALDataType datetype = this->getDataType(); - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - if (start_row + rowcount > this->height || start_col + colcount > this->width) { - QString tip = u8"file path: " + this->img_path + " image size :( " + QString::number(this->height) + " , " + QString::number(this->width) + " ) " + " input size (" + QString::number(start_row + rowcount) + ", " + QString::number(start_col + colcount) + ") "; - qDebug() << tip; - throw std::exception(tip.toUtf8().constData()); - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - QString filesuffer = getFileExtension(this->img_path).toLower(); - bool isTiff = filesuffer.contains("tif"); - GDALDriver* poDriver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI"); - GDALDataset* poDstDS = nullptr; - if (exists_test(this->img_path)) { - poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update)); - } - else { - poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height, - this->band_num, GDT_Float32, NULL); // ��� - poDstDS->SetProjection(this->projection.toUtf8().constData()); - - double gt_ptr[6]; - for (int i = 0; i < this->gt.rows(); i++) { - for (int j = 0; j < this->gt.cols(); j++) { - gt_ptr[i * 3 + j] = this->gt(i, j); - } - } - poDstDS->SetGeoTransform(gt_ptr); - } - - long datarows = rowcount; - long datacols = colcount; - float* databuffer = new float[datarows * datacols]; - if (datetype == GDT_Float32) { - memcpy(databuffer, data.get(), sizeof(float) * datarows * datacols); - } - else { - for (long i = 0; i < datarows; i++) { - for (long j = 0; j < datacols; j++) { - databuffer[i * datacols + j] = data.get()[i * datacols + j]; - } - } - } - - // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols, - // datarows, GDT_Float32,band_ids, num,0,0,0); - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, - databuffer, datacols, datarows, datetype, 0, 0); - - GDALFlushCache(poDstDS); - GDALClose((GDALDatasetH)poDstDS); - //delete poDstDS; - //poDstDS = nullptr; - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - delete[] databuffer; - omp_unset_lock(&lock); // �ͷŻ�� - omp_destroy_lock(&lock); // ٻ�� -} - - -void gdalImage::saveImage(std::shared_ptr data, int start_row, int start_col, int rowcount, int colcount, int band_ids) -{ - GDALDataType datetype = this->getDataType(); - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - if (start_row + rowcount > this->height || start_col + colcount > this->width) { - QString tip = u8"file path: " + this->img_path + " image size :( " + QString::number(this->height) + " , " + QString::number(this->width) + " ) " + " input size (" + QString::number(start_row + rowcount) + ", " + QString::number(start_col + colcount) + ") "; - qDebug() << tip; - throw std::exception(tip.toUtf8().constData()); - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - QString filesuffer = getFileExtension(this->img_path).toLower(); - bool isTiff = filesuffer.contains("tif"); - GDALDriver* poDriver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI"); - GDALDataset* poDstDS = nullptr; - if (exists_test(this->img_path)) { - poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update)); - } - else { - poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height, - this->band_num, GDT_Float32, NULL); // ��� - poDstDS->SetProjection(this->projection.toUtf8().constData()); - - double gt_ptr[6]; - for (int i = 0; i < this->gt.rows(); i++) { - for (int j = 0; j < this->gt.cols(); j++) { - gt_ptr[i * 3 + j] = this->gt(i, j); - } - } - poDstDS->SetGeoTransform(gt_ptr); - } - - long datarows = rowcount; - long datacols = colcount; - int* databuffer = new int[datarows * datacols]; - if (datetype == GDT_Int32) { - memcpy(databuffer, data.get(), sizeof(int) * datarows * datacols); - } - else { - for (long i = 0; i < datarows; i++) { - for (long j = 0; j < datacols; j++) { - databuffer[i * datacols + j] = data.get()[i * datacols + j]; - } - } - } - - // poDstDS->RasterIO(GF_Write,start_col, start_row, datacols, datarows, databuffer, datacols, - // datarows, GDT_Float32,band_ids, num,0,0,0); - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_col, start_row, datacols, datarows, - databuffer, datacols, datarows, datetype, 0, 0); - - GDALFlushCache(poDstDS); - GDALClose((GDALDatasetH)poDstDS); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - delete[] databuffer; - omp_unset_lock(&lock); // �ͷŻ�� - omp_destroy_lock(&lock); // ٻ�� -} - - -void gdalImage::saveImage() -{ - this->saveImage(this->data, this->start_row, this->start_col, this->data_band_ids); -} - - - - -void gdalImage::setNoDataValue(double nodatavalue = -9999, int band_ids = 1) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // עʽ��?1?7 - // GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - GDALDataset* poDstDS = (GDALDataset*)(GDALOpen(img_path.toUtf8().constData(), GA_Update)); - poDstDS->GetRasterBand(band_ids)->SetNoDataValue(nodatavalue); - GDALFlushCache((GDALDatasetH)poDstDS); - GDALClose((GDALDatasetH)poDstDS); -} - -void gdalImage::setNoDataValuei(int nodatavalue, int band_ids) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // עʽ��?1?7 - // GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - GDALDataset* poDstDS = (GDALDataset*)(GDALOpen(img_path.toUtf8().constData(), GA_Update)); - poDstDS->GetRasterBand(band_ids)->SetNoDataValue(nodatavalue); - GDALFlushCache((GDALDatasetH)poDstDS); - GDALClose((GDALDatasetH)poDstDS); -} - -double gdalImage::getNoDataValue(int band_ids) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // עʽ��?1?7 - // GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - GDALDataset* poDstDS = (GDALDataset*)(GDALOpen(img_path.toUtf8().constData(), GA_Update)); - double v = poDstDS->GetRasterBand(band_ids)->GetNoDataValue(); - GDALFlushCache((GDALDatasetH)poDstDS); - GDALClose((GDALDatasetH)poDstDS); - return v; -} - -int gdalImage::getNoDataValuei(int band_ids) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // עʽ��?1?7 - // GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - GDALDataset* poDstDS = (GDALDataset*)(GDALOpen(img_path.toUtf8().constData(), GA_Update)); - int v = poDstDS->GetRasterBand(band_ids)->GetNoDataValue(); - GDALFlushCache((GDALDatasetH)poDstDS); - GDALClose((GDALDatasetH)poDstDS); - return v; -} - - -int gdalImage::InitInv_gt() -{ - // 1 lon lat = x - // 1 lon lat = y - Eigen::MatrixXd temp = Eigen::MatrixXd::Zero(2, 3); - this->inv_gt = temp; - double a = this->gt(0, 0); - double b = this->gt(0, 1); - double c = this->gt(0, 2); - double d = this->gt(1, 0); - double e = this->gt(1, 1); - double f = this->gt(1, 2); - double g = 1; - double det_gt = b * f - c * e; - if (det_gt == 0) { - return 0; - } - this->inv_gt(0, 0) = (c * d - a * f) / det_gt; // 2 - this->inv_gt(0, 1) = f / det_gt; // lon - this->inv_gt(0, 2) = -c / det_gt; // lat - this->inv_gt(1, 0) = (a * e - b * d) / det_gt; // 1 - this->inv_gt(1, 1) = -e / det_gt; // lon - this->inv_gt(1, 2) = b / det_gt; // lat - return 1; -} - -Landpoint gdalImage::getRow_Col(double lon, double lat) -{ - Landpoint p{ 0, 0, 0 }; - p.lon = this->inv_gt(0, 0) + lon * this->inv_gt(0, 1) + lat * this->inv_gt(0, 2); // x - p.lat = this->inv_gt(1, 0) + lon * this->inv_gt(1, 1) + lat * this->inv_gt(1, 2); // y - return p; -} - -Landpoint gdalImage::getLandPoint(double row, double col, double ati = 0) -{ - Landpoint p{ 0, 0, 0 }; - p.lon = this->gt(0, 0) + col * this->gt(0, 1) + row * this->gt(0, 2); // x - p.lat = this->gt(1, 0) + col * this->gt(1, 1) + row * this->gt(1, 2); // y - p.ati = ati; - return p; -} - -void gdalImage::getLandPoint(double row, double col, double ati, Landpoint& Lp) -{ - Lp.lon = this->gt(0, 0) + col * this->gt(0, 1) + row * this->gt(0, 2); // x - Lp.lat = this->gt(1, 0) + col * this->gt(1, 1) + row * this->gt(1, 2); // y - Lp.ati = ati; - -} - - - - - - -double gdalImage::mean(int bandids) -{ - double mean_value = 0; - double count = this->height * this->width; - int line_invert = 100; - int start_ids = 0; - do { - Eigen::MatrixXd sar_a = this->getData(start_ids, 0, line_invert, this->width, bandids); - mean_value = mean_value + sar_a.sum() / count; - start_ids = start_ids + line_invert; - } while (start_ids < this->height); - return mean_value; -} - -double gdalImage::BandmaxValue(int bandids) -{ - double max_value = 0; - bool state_max = true; - int line_invert = 100; - int start_ids = 0; - double temp_max = 0; - do { - Eigen::MatrixXd sar_a = this->getData(start_ids, 0, line_invert, this->width, bandids); - if (state_max) { - state_max = false; - max_value = sar_a.maxCoeff(); - } - else { - temp_max = sar_a.maxCoeff(); - if (max_value < temp_max) { - max_value = temp_max; - } - } - start_ids = start_ids + line_invert; - } while (start_ids < this->height); - return max_value; -} - -double gdalImage::BandminValue(int bandids) -{ - double min_value = 0; - bool state_min = true; - int line_invert = 100; - int start_ids = 0; - double temp_min = 0; - do { - Eigen::MatrixXd sar_a = this->getData(start_ids, 0, line_invert, this->width, bandids); - if (state_min) { - state_min = false; - min_value = sar_a.minCoeff(); - } - else { - temp_min = sar_a.minCoeff(); - if (min_value < temp_min) { - min_value = temp_min; - } - } - start_ids = start_ids + line_invert; - } while (start_ids < this->height); - return min_value; -} - -GDALRPCInfo gdalImage::getRPC() -{ - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO"); - CPLSetConfigOption("GDAL_DATA", "./data"); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // ע��� - // ��� - GDALDataset* pDS = (GDALDataset*)GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly); - // ��Ԫ��л�ȡRPC��Ϣ - char** papszRPC = pDS->GetMetadata("RPC"); - - // �ȡ��RPC��Ϣ�ɽṹ�?1?7 - GDALRPCInfo oInfo; - GDALExtractRPCInfo(papszRPC, &oInfo); - - GDALClose((GDALDatasetH)pDS); - - return oInfo; -} - -Eigen::MatrixXd gdalImage::getLandPoint(Eigen::MatrixXd points) -{ - if (points.cols() != 3) { - throw new std::exception("the size of points is equit 3!!!"); - } - - Eigen::MatrixXd result(points.rows(), 3); - result.col(2) = points.col(2); // �߳� - points.col(2) = points.col(2).array() * 0 + 1; - points.col(0).swap(points.col(2)); // � - Eigen::MatrixXd gts(3, 2); - gts.col(0) = this->gt.row(0); - gts.col(1) = this->gt.row(1); - - result.block(0, 0, points.rows(), 2) = points * gts; - return result; -} - -Eigen::MatrixXd gdalImage::getHist(int bandids) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // עʽ��?1?7 - // ��DEMӰ�� - GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen( - this->img_path.toUtf8().constData(), GA_ReadOnly)); // ��ֻ�ʽ��ȡ�Ӱ�� - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - GDALRasterBand* xBand = rasterDataset->GetRasterBand(bandids); - - double dfMin = this->BandminValue(bandids); - double dfMax = this->BandmaxValue(bandids); - int count = int((dfMax - dfMin) / 0.01); - count = count > 255 ? count : 255; - GUIntBig* panHistogram = new GUIntBig[count]; - xBand->GetHistogram(dfMin, dfMax, count, panHistogram, TRUE, FALSE, NULL, NULL); - Eigen::MatrixXd result(count, 2); - double delta = (dfMax - dfMin) / count; - for (int i = 0; i < count; i++) { - result(i, 0) = dfMin + i * delta; - result(i, 1) = double(panHistogram[i]); - } - delete[] panHistogram; - GDALClose((GDALDatasetH)rasterDataset); - return result; -} - -RasterExtend gdalImage::getExtend() -{ - RasterExtend extend{ 0,0,0,0 }; - double x1 = this->gt(0, 0); - double y1 = this->gt(1, 0); - - double x2 = this->gt(0, 0) + (this->width - 1) * gt(0, 1) + (0) * gt(0, 2); // - double y2 = this->gt(1, 0) + (this->width - 1) * gt(1, 1) + (0) * gt(1, 2); // γ - - double x3 = this->gt(0, 0) + (0) * gt(0, 1) + (this->height - 1) * gt(0, 2); - double y3 = this->gt(1, 0) + (0) * gt(1, 1) + (this->height - 1) * gt(1, 2); - - double x4 = this->gt(0, 0) + (this->width - 1) * gt(0, 1) + (this->height - 1) * gt(0, 2); - double y4 = this->gt(1, 0) + (this->width - 1) * gt(1, 1) + (this->height - 1) * gt(1, 2); - - - extend.min_x = x1 < x2 ? x1 : x2; - extend.max_x = x1 < x2 ? x2 : x1; - extend.min_y = y1 < y2 ? y1 : y2; - extend.max_y = y1 < y2 ? y2 : y1; - - - extend.min_x = extend.min_x < x3 ? extend.min_x : x3; - extend.max_x = extend.max_x > x3 ? extend.max_x : x3; - extend.min_y = extend.min_y < y3 ? extend.min_y : y3; - extend.max_y = extend.max_y > y3 ? extend.max_y : y3; - - - extend.min_x = extend.min_x < x4 ? extend.min_x : x4; - extend.max_x = extend.max_x > x4 ? extend.max_x : x4; - extend.min_y = extend.min_y < y4 ? extend.min_y : y4; - extend.max_y = extend.max_y > y4 ? extend.max_y : y4; - - return extend; -} - - - - - - -gdalImage CreategdalImageDouble(QString& img_path, int height, int width, int band_num, bool overwrite, bool isEnvi) -{ - - if (exists_test(img_path.toUtf8().constData())) { - if (overwrite) { - gdalImage result_img(img_path); - return result_img; - } - else { - throw "file has exist!!!"; - exit(1); - } - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // ע���ʽ�����?1?7 - GDALDriver* poDriver = nullptr; - if (isEnvi) { - poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - } - else { - poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - } - - - GDALDataset* poDstDS = poDriver->Create(img_path.toUtf8().constData(), width, height, band_num, GDT_Float64, NULL); // ������ - GDALFlushCache((GDALDatasetH)poDstDS); - GDALClose((GDALDatasetH)poDstDS); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - gdalImage result_img(img_path); - return result_img; - -} - -gdalImage CreategdalImageFloat(QString& img_path, int height, int width, int band_num, bool overwrite, bool isEnvi) -{ - - if (exists_test(img_path.toUtf8().constData())) { - if (overwrite) { - gdalImage result_img(img_path); - return result_img; - } - else { - throw "file has exist!!!"; - exit(1); - } - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // ע���ʽ�����?1?7 - GDALDriver* poDriver = nullptr; - if (isEnvi) { - poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - } - else { - poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - } - - - GDALDataset* poDstDS = poDriver->Create(img_path.toUtf8().constData(), width, height, band_num, GDT_Float32, NULL); // ������ - GDALFlushCache((GDALDatasetH)poDstDS); - GDALClose((GDALDatasetH)poDstDS); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - gdalImage result_img(img_path); - return result_img; -} - -gdalImage CreategdalImageDouble(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt, bool overwrite, bool isEnvi) -{ - if (exists_test(img_path.toUtf8().constData())) { - if (overwrite) { - gdalImage result_img(img_path); - return result_img; - } - else { - throw "file has exist!!!"; - exit(1); - } - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // ע���ʽ�����?1?7 - GDALDriver* poDriver = nullptr; - if (isEnvi) { - poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - } - else { - poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - } - - - GDALDataset* poDstDS = poDriver->Create(img_path.toUtf8().constData(), width, height, band_num, - GDT_Float64, NULL); // ������ - if (need_gt) { - if (!projection.isEmpty()) { - poDstDS->SetProjection(projection.toUtf8().constData()); - } - double gt_ptr[6] = { 0 }; - for (int i = 0; i < gt.rows(); i++) { - for (int j = 0; j < gt.cols(); j++) { - gt_ptr[i * 3 + j] = gt(i, j); - } - } - poDstDS->SetGeoTransform(gt_ptr); - } - for (int i = 1; i <= band_num; i++) { - poDstDS->GetRasterBand(i)->SetNoDataValue(-9999); - } - GDALFlushCache((GDALDatasetH)poDstDS); - GDALClose((GDALDatasetH)poDstDS); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - gdalImage result_img(img_path); - return result_img; -} - -gdalImage CreategdalImage(const QString& img_path, int height, int width, int band_num, - Eigen::MatrixXd gt, QString projection, bool need_gt, bool overwrite, bool isEnvi, GDALDataType datetype) -{ - if (exists_test(img_path.toUtf8().constData())) { - if (overwrite) { - gdalImage result_img(img_path); - return result_img; - } - else { - throw "file has exist!!!"; - exit(1); - } - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // ע���ʽ�����?1?7 - GDALDriver* poDriver = nullptr; - if (isEnvi) { - poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - } - else { - poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - } - - - GDALDataset* poDstDS = poDriver->Create(img_path.toUtf8().constData(), width, height, band_num, - datetype, NULL); // ������ - - if (NULL == poDstDS) - { - qDebug() << "Create image failed!"; - throw "Create image failed!"; - exit(1); - } - - - if (need_gt) { - if (!projection.isEmpty()) { - poDstDS->SetProjection(projection.toUtf8().constData()); - } - double gt_ptr[6] = { 0 }; - for (int i = 0; i < gt.rows(); i++) { - for (int j = 0; j < gt.cols(); j++) { - gt_ptr[i * 3 + j] = gt(i, j); - } - } - poDstDS->SetGeoTransform(gt_ptr); - } - for (int i = 1; i <= band_num; i++) { - poDstDS->GetRasterBand(i)->SetNoDataValue(-9999); - } - GDALFlushCache((GDALDatasetH)poDstDS); - GDALClose((GDALDatasetH)poDstDS); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - gdalImage result_img(img_path); - return result_img; -} - -gdalImage CreategdalImage(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, long epsgCode, GDALDataType eType, bool need_gt, bool overwrite, bool isENVI) -{ - if (exists_test(img_path.toUtf8().constData())) { - if (overwrite) { - gdalImage result_img(img_path); - return result_img; - } - else { - throw "file has exist!!!"; - exit(1); - } - } - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // ע���ʽ�����?1?7 - GDALDriver* poDriver = isENVI ? GetGDALDriverManager()->GetDriverByName("ENVI") : GetGDALDriverManager()->GetDriverByName("GTiff"); - GDALDataset* poDstDS = poDriver->Create(img_path.toUtf8().constData(), width, height, band_num, eType, NULL); // ������ - if (need_gt) { - OGRSpatialReference oSRS; - - if (oSRS.importFromEPSG(epsgCode) != OGRERR_NONE) { - qDebug() << "Failed to import EPSG code " << epsgCode; - throw "Failed to import EPSG code "; - exit(1); - } - char* pszWKT = NULL; - oSRS.exportToWkt(&pszWKT); - qDebug() << "WKT of EPSG:" << epsgCode << " :\n" << pszWKT; - poDstDS->SetProjection(pszWKT); - double gt_ptr[6] = { 0 }; - for (int i = 0; i < gt.rows(); i++) { - for (int j = 0; j < gt.cols(); j++) { - gt_ptr[i * 3 + j] = gt(i, j); - } - } - poDstDS->SetGeoTransform(gt_ptr); - } - for (int i = 1; i <= band_num; i++) { - poDstDS->GetRasterBand(i)->SetNoDataValue(-9999); - } - GDALFlushCache((GDALDatasetH)poDstDS); - GDALClose((GDALDatasetH)poDstDS); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - gdalImage result_img(img_path); - return result_img; -} - - -bool CopyProjectTransformMatrixFromRasterAToRasterB(QString RasterAPath, QString RasterBPath) { - // עGDAL - GDALAllRegister(); - - // ӰAֻģʽ - GDALDataset* ds_a = (GDALDataset*)GDALOpen(RasterAPath.toUtf8().constData(), GA_ReadOnly); - if (ds_a == nullptr) { - std::cerr << "޷ӰA" << std::endl; - return false; - } - - // ȡAķͶӰϢ - double geotransform[6]; - ds_a->GetGeoTransform(geotransform); // 任 - const char* projection = ds_a->GetProjectionRef(); // WKTʽͶӰ - - // ӰBģʽ - GDALDataset* ds_b = (GDALDataset*)GDALOpen(RasterBPath.toUtf8().constData(), GA_Update); - if (ds_b == nullptr) { - std::cerr << "޷ӰB" << std::endl; - GDALClose(ds_a); - return false; - } - - // ÷ - if (ds_b->SetGeoTransform(geotransform) != CE_None) { - std::cerr << "÷ʧ" << std::endl; - } - - // ͶӰϵ - if (ds_b->SetProjection(projection) != CE_None) { - std::cerr << "ͶӰʧ" << std::endl; - } - - // ͷԴ - GDALClose(ds_a); - GDALClose(ds_b); - - return true; - - - - - -} - - - - diff --git a/BaseCommonLibrary/BaseTool/stdafx.cpp b/BaseCommonLibrary/BaseTool/stdafx.cpp deleted file mode 100644 index fd4f341..0000000 --- a/BaseCommonLibrary/BaseTool/stdafx.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "stdafx.h" diff --git a/BaseCommonLibrary/ImageOperatorFuntion.cpp b/BaseCommonLibrary/ImageOperatorFuntion.cpp deleted file mode 100644 index ee94390..0000000 --- a/BaseCommonLibrary/ImageOperatorFuntion.cpp +++ /dev/null @@ -1,2138 +0,0 @@ -#include "stdafx.h" -#include "ImageOperatorBase.h" -#include "BaseTool.h" -#include "GeoOperator.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "FileOperator.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include // OGRSpatialReference 用于空间参考转换 -#include // 用于 GDALWarp 操作 - -#include "gdal_priv.h" -#include "cpl_conv.h" -#include - - -std::shared_ptr OpenDataset(const QString& in_path, GDALAccess rwmode) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDataset* dataset_ptr = (GDALDataset*)(GDALOpen(in_path.toUtf8().constData(), rwmode)); - std::shared_ptr rasterDataset(dataset_ptr, CloseDataset); - return rasterDataset; -} - - -void CloseDataset(GDALDataset* ptr) -{ - GDALClose(ptr); - ptr = NULL; -} - - -int CreateDataset(QString new_file_path, int height, int width, int band_num, double* gt, - QString projection, GDALDataType gdal_dtype, bool need_gt) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - std::shared_ptr poDstDS(poDriver->Create(new_file_path.toUtf8().constData(), width, - height, band_num, gdal_dtype, NULL)); - if (need_gt) { - poDstDS->SetProjection(projection.toUtf8().constData()); - poDstDS->SetGeoTransform(gt); - } - else { - } - GDALFlushCache((GDALDatasetH)poDstDS.get()); - return 0; -} - -int saveDataset(QString new_file_path, int start_line, int start_cols, int band_ids, int datacols, - int datarows, void* databuffer) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - std::shared_ptr poDstDS = OpenDataset(new_file_path, GA_Update); - GDALDataType gdal_datatype = poDstDS->GetRasterBand(1)->GetRasterDataType(); - poDstDS->GetRasterBand(band_ids)->RasterIO(GF_Write, start_cols, start_line, datacols, datarows, - databuffer, datacols, datarows, gdal_datatype, 0, 0); - GDALFlushCache(poDstDS.get()); - return 0; -} - - - - -ImageGEOINFO getImageINFO(QString in_path) -{ - std::shared_ptr df = OpenDataset(in_path); - int width = df->GetRasterXSize(); - int heigh = df->GetRasterYSize(); - int band_num = df->GetRasterCount(); - ImageGEOINFO result; - result.width = width; - result.height = heigh; - result.bandnum = band_num; - - return result; -} - -GDALDataType getGDALDataType(QString fileptah) -{ - omp_lock_t lock; - omp_init_lock(&lock); - omp_set_lock(&lock); - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen( - fileptah.toUtf8().constData(), GA_ReadOnly)); // 锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷 - - GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); - - GDALClose((GDALDatasetH)rasterDataset); - omp_unset_lock(&lock); // 锟酵放伙拷斤拷 - omp_destroy_lock(&lock); // 劫伙拷斤拷 - - return gdal_datatype; -} - - - - - - - -int block_num_pre_memory(int block_width, int height, GDALDataType gdal_datatype, double memey_size) -{ - // 计算大小 - int size_meta = 0; - - if (gdal_datatype == GDT_Byte) { - size_meta = 1; - } - else if (gdal_datatype == GDT_UInt16) { - size_meta = 2; // 只有双通道才能构建 复数矩阵 - } - else if (gdal_datatype == GDT_UInt16) { - size_meta = 2; - } - else if (gdal_datatype == GDT_Int16) { - size_meta = 2; - } - else if (gdal_datatype == GDT_UInt32) { - size_meta = 4; - } - else if (gdal_datatype == GDT_Int32) { - size_meta = 4; - } - // else if (gdal_datatype == GDT_UInt64) { - // size_meta = 8; - // } - // else if (gdal_datatype == GDT_Int64) { - // size_meta = 8; - // } - else if (gdal_datatype == GDT_Float32) { - size_meta = 4; - } - else if (gdal_datatype == GDT_Float64) { - size_meta = 4; - } - else if (gdal_datatype == GDT_CInt16) { - size_meta = 2; - } - else if (gdal_datatype == GDT_CInt32) { - size_meta = 2; - } - else if (gdal_datatype == GDT_CFloat32) { - size_meta = 4; - } - else if (gdal_datatype == GDT_CFloat64) { - size_meta = 8; - } - else { - } - int block_num = int(memey_size / (size_meta * block_width)); - block_num = block_num > height ? height : block_num; // 行数 - block_num = block_num < 1 ? 1 : block_num; - return block_num; -} - - - - -int TIFF2ENVI(QString in_tiff_path, QString out_envi_path) -{ - std::shared_ptr ds = OpenDataset(in_tiff_path); - const char* args[] = { "-of", "ENVI", NULL }; - GDALTranslateOptions* psOptions = GDALTranslateOptionsNew((char**)args, NULL); - GDALClose(GDALTranslate(out_envi_path.toUtf8().constData(), ds.get(), psOptions, NULL)); - GDALTranslateOptionsFree(psOptions); - return 0; -} - -int ENVI2TIFF(QString in_envi_path, QString out_tiff_path) -{ - std::shared_ptr ds = OpenDataset(in_envi_path); - const char* args[] = { "-of", "Gtiff", NULL }; - GDALTranslateOptions* psOptions = GDALTranslateOptionsNew((char**)args, NULL); - GDALClose(GDALTranslate(out_tiff_path.toUtf8().constData(), ds.get(), psOptions, NULL)); - GDALTranslateOptionsFree(psOptions); - return 0; -} - - - -void ConvertCoordinateSystem(QString inRasterPath, QString outRasterPath, long outepsgcode) { - // 注册所有GDAL驱动 - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - // 打开输入栅格文件 - GDALDataset* srcDataset = (GDALDataset*)GDALOpen(inRasterPath.toUtf8().constData(), GA_ReadOnly); - if (!srcDataset) { - // 错误处理:输出文件打开失败 - // qDebug() << "无法打开输入文件:" << inRasterPath; - return; - } - - // 创建目标坐标系 - OGRSpatialReference targetSRS; - if (targetSRS.importFromEPSG(outepsgcode) != OGRERR_NONE) { - GDALClose(srcDataset); - // qDebug() << "无效的EPSG代码:" << outepsgcode; - return; - } - GDALDataType datetype = srcDataset->GetRasterBand(1)->GetRasterDataType(); - // 获取目标坐标系的WKT表示 - char* targetSRSWkt = nullptr; - targetSRS.exportToWkt(&targetSRSWkt); - - bool flag = (datetype == GDT_Byte || datetype == GDT_Int8 || datetype == GDT_Int16 || datetype == GDT_UInt16 || datetype == GDT_Int32 || datetype == GDT_UInt32 || datetype == GDT_Int64 || datetype == GDT_UInt64); - - // 创建重投影后的虚拟数据集(Warped VRT) - GDALDataset* warpedVRT = flag ? (GDALDataset*)GDALAutoCreateWarpedVRT( - srcDataset, - nullptr, // 输入坐标系(默认使用源数据) - targetSRSWkt, // 目标坐标系 - GRA_NearestNeighbour, // 重采样方法:双线性插值 - 0.0, // 最大误差(0表示自动计算) - nullptr // 其他选项 - ) : (GDALDataset*)GDALAutoCreateWarpedVRT( - srcDataset, - nullptr, // 输入坐标系(默认使用源数据) - targetSRSWkt, // 目标坐标系 - GRA_Bilinear, // 重采样方法:双线性插值 - 0.0, // 最大误差(0表示自动计算) - nullptr // 其他选项 - ); - CPLFree(targetSRSWkt); // 释放WKT内存 - - if (!warpedVRT) { - GDALClose(srcDataset); - qDebug() << u8"创建投影转换VRT失败"; - return; - } - - // 获取输出驱动(GeoTIFF格式) - QString filesuffer = getFileExtension(outRasterPath).toLower(); - bool isTiff = filesuffer.contains("tif"); - GDALDriver* driver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI"); - if (!driver) { - GDALClose(warpedVRT); - GDALClose(srcDataset); - // qDebug() << "无法获取GeoTIFF驱动"; - return; - } - - // 创建输出栅格文件 - GDALDataset* dstDataset = driver->CreateCopy( - outRasterPath.toUtf8().constData(), // 输出文件路径 - warpedVRT, // 输入数据集(VRT) - false, // 是否严格复制 - nullptr, // 创建选项 - nullptr, // 进度回调 - nullptr // 回调参数 - ); - - if (!dstDataset) { - // qDebug() << "创建输出文件失败:" << outRasterPath; - GDALClose(warpedVRT); - GDALClose(srcDataset); - return; - } - - // 释放资源 - GDALClose(dstDataset); - GDALClose(warpedVRT); - GDALClose(srcDataset); -} - - -void ResampleByReferenceRasterB(QString pszSrcFile, QString RefrasterBPath, QString pszOutFile, GDALResampleAlg eResample) { - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - GDALDataset* pDSrc = (GDALDataset*)GDALOpen(pszSrcFile.toLocal8Bit().constData(), GA_ReadOnly); - if (pDSrc == NULL) { - qDebug() << u8"do not open In Raster file: " << pszSrcFile; - return; - } - - GDALDataset* pDRef = (GDALDataset*)GDALOpen(RefrasterBPath.toLocal8Bit().constData(), GA_ReadOnly); - if (pDRef == NULL) { - qDebug() << u8"do not open Ref Raster file: " << RefrasterBPath; - return; - } - - QString filesuffer = getFileExtension(pszOutFile).toLower(); - bool isTiff = filesuffer.contains("tif"); - GDALDriver* pDriver = isTiff ? GetGDALDriverManager()->GetDriverByName("GTiff") : GetGDALDriverManager()->GetDriverByName("ENVI"); - - if (pDriver == NULL) { - qDebug() << "not open driver"; - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return; - } - int width = pDSrc->GetRasterXSize(); - int height = pDSrc->GetRasterYSize(); - int nBandCount = pDSrc->GetRasterCount(); - GDALDataType dataType = pDSrc->GetRasterBand(1)->GetRasterDataType(); - - char* pszSrcWKT = NULL; - pszSrcWKT = const_cast(pDSrc->GetProjectionRef()); - - // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7 - if (strlen(pszSrcWKT) <= 0) { - OGRSpatialReference oSRS; - oSRS.importFromEPSG(4326); - // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷 - // oSRS.SetWellKnownGeogCS("WGS84"); - oSRS.exportToWkt(&pszSrcWKT); - } - - char* pdstSrcWKT = NULL; - pdstSrcWKT = const_cast(pDRef->GetProjectionRef()); - - // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7 - if (strlen(pdstSrcWKT) <= 0) - { - OGRSpatialReference oSRS; - oSRS.importFromEPSG(4326); - // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷 - // oSRS.SetWellKnownGeogCS("WGS84"); - oSRS.exportToWkt(&pdstSrcWKT); - } - - - int new_width = pDRef->GetRasterXSize(); - int new_height = pDRef->GetRasterYSize(); - double gt[6]; - pDRef->GetGeoTransform(gt); - - // GDALDestroyGenImgProjTransformer(hTransformArg); - qDebug() << "create init GDALDataset "; - GDALDataset* pDDst = - pDriver->Create(pszOutFile.toLocal8Bit().constData(), new_width, new_height, nBandCount, dataType, NULL); - if (pDDst == NULL) { - qDebug() << "not create init GDALDataset "; - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALClose((GDALDatasetH)(GDALDatasetH)pDRef); - return; - } - - pDDst->SetProjection(pdstSrcWKT); - pDDst->SetGeoTransform(gt); - - - qDebug() << "GDALCreateGenImgProjTransformer " << Qt::endl; - void* hTransformArg; - hTransformArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, NULL, pszSrcWKT, - FALSE, 0.0, 1); - qDebug() << "no proj "; - //(没锟斤拷投影锟斤拷影锟斤拷锟斤拷锟斤拷锟斤拷卟锟酵?拷锟?1锟?7) - if (hTransformArg == NULL) { - qDebug() << "hTransformArg create failure"; - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALClose((GDALDatasetH)(GDALDatasetH)pDRef); - return; - } - qDebug() << "has proj "; - double dGeoTrans[6] = { 0 }; - int nNewWidth = 0, nNewHeight = 0; - if (GDALSuggestedWarpOutput((GDALDatasetH)pDSrc, GDALGenImgProjTransform, hTransformArg, - dGeoTrans, &nNewWidth, &nNewHeight) - != CE_None) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALClose((GDALDatasetH)(GDALDatasetH)pDRef); - return; - } - - - - GDALWarpOptions* psWo = GDALCreateWarpOptions(); - CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // 使用所有可用的CPU核心 - CPLSetConfigOption("GDAL_CACHEMAX", "16000"); // 设置缓存大小为500MB - // psWo->papszWarpOptions = CSLDuplicate(NULL); - psWo->eWorkingDataType = dataType; - - - - psWo->eResampleAlg = eResample; - - psWo->hSrcDS = (GDALDatasetH)pDSrc; - psWo->hDstDS = (GDALDatasetH)pDDst; - qDebug() << "GDALCreateGenImgProjTransformer"; - psWo->pfnTransformer = GDALGenImgProjTransform; - psWo->pTransformerArg = GDALCreateGenImgProjTransformer( - (GDALDatasetH)pDSrc, pszSrcWKT, (GDALDatasetH)pDDst, pszSrcWKT, FALSE, 0.0, 1); - ; - - qDebug() << "GDALCreateGenImgProjTransformer has created" << Qt::endl; - psWo->nBandCount = nBandCount; - psWo->panSrcBands = (int*)CPLMalloc(nBandCount * sizeof(int)); - psWo->panDstBands = (int*)CPLMalloc(nBandCount * sizeof(int)); - for (int i = 0; i < nBandCount; i++) { - psWo->panSrcBands[i] = i + 1; - psWo->panDstBands[i] = i + 1; - } - - GDALWarpOperation oWo; - if (oWo.Initialize(psWo) != CE_None) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALClose((GDALDatasetH)(GDALDatasetH)pDRef); - return; - } - qDebug() << "ChunkAndWarpImage:" << new_width << "," << new_height << Qt::endl; - oWo.ChunkAndWarpMulti(0, 0, new_width, new_height); - GDALFlushCache(pDDst); - qDebug() << "ChunkAndWarpImage over" << Qt::endl; - // GDALDestroyGenImgProjTransformer(psWo->pTransformerArg); - // GDALDestroyWarpOptions(psWo); - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALClose((GDALDatasetH)(GDALDatasetH)pDRef); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - return; -} - - -void ResampleByReferenceRasterB(QString InrasterAPath, QString RefrasterBPath, QString OutrasterCPath) { - // 注册所有GDAL驱动 - GDALAllRegister(); - - // 打开参考栅格B - GDALDataset* refDS = (GDALDataset*)GDALOpen(RefrasterBPath.toUtf8().constData(), GA_ReadOnly); - if (!refDS) { - qDebug() << "无法打开参考栅格B:" << RefrasterBPath; - return; - } - - // 获取参考栅格的地理变换、投影和尺寸 - double geotransform[6]; - if (refDS->GetGeoTransform(geotransform) != CE_None) { - qDebug() << "获取参考栅格的地理变换失败。"; - GDALClose(refDS); - return; - } - - const char* proj = refDS->GetProjectionRef(); - int cols = refDS->GetRasterXSize(); - int rows = refDS->GetRasterYSize(); - GDALClose(refDS); // 获取信息后关闭参考栅格 - - // 打开输入栅格A - GDALDataset* srcDS = (GDALDataset*)GDALOpen(InrasterAPath.toUtf8().constData(), GA_ReadOnly); - if (!srcDS) { - qDebug() << "无法打开输入栅格A:" << InrasterAPath; - return; - } - - // 获取输入栅格的波段数和数据类型 - int nBands = srcDS->GetRasterCount(); - if (nBands == 0) { - qDebug() << "输入栅格没有波段数据。"; - GDALClose(srcDS); - return; - } - GDALDataType dataType = srcDS->GetRasterBand(1)->GetRasterDataType(); - - // 创建输出栅格C - GDALDriver* driver = GetGDALDriverManager()->GetDriverByName("GTiff"); - if (!driver) { - qDebug() << "无法获取GeoTIFF驱动。"; - GDALClose(srcDS); - return; - } - - GDALDataset* dstDS = driver->Create( - OutrasterCPath.toUtf8().constData(), - cols, - rows, - nBands, - dataType, - nullptr - ); - if (!dstDS) { - qDebug() << "无法创建输出栅格:" << OutrasterCPath; - GDALClose(srcDS); - return; - } - - // 设置输出栅格的地理变换和投影 - dstDS->SetGeoTransform(geotransform); - dstDS->SetProjection(proj); - - // 配置GDAL Warp选项 - GDALWarpOptions* psWO = GDALCreateWarpOptions(); - psWO->hSrcDS = srcDS; - psWO->hDstDS = dstDS; - psWO->nBandCount = nBands; - psWO->panSrcBands = (int*)CPLMalloc(nBands * sizeof(int)); - psWO->panDstBands = (int*)CPLMalloc(nBands * sizeof(int)); - for (int i = 0; i < nBands; ++i) { - psWO->panSrcBands[i] = i + 1; - psWO->panDstBands[i] = i + 1; - } - psWO->eResampleAlg = GRA_NearestNeighbour; // 使用最近邻重采样 - - // 初始化坐标转换器 - psWO->pfnTransformer = GDALGenImgProjTransform; - psWO->pTransformerArg = GDALCreateGenImgProjTransformer( - srcDS, GDALGetProjectionRef(srcDS), - dstDS, GDALGetProjectionRef(dstDS), - FALSE, 0.0, 1 - ); - if (!psWO->pTransformerArg) { - qDebug() << "创建坐标转换器失败。"; - GDALDestroyWarpOptions(psWO); - GDALClose(srcDS); - GDALClose(dstDS); - return; - } - - // 执行Warp操作 - GDALWarpOperation oWarp; - if (oWarp.Initialize(psWO) != CE_None) { - qDebug() << "初始化Warp操作失败。"; - GDALDestroyGenImgProjTransformer(psWO->pTransformerArg); - GDALDestroyWarpOptions(psWO); - GDALClose(srcDS); - GDALClose(dstDS); - return; - } - - CPLErr eErr = oWarp.ChunkAndWarpImage(0, 0, cols, rows); - if (eErr != CE_None) { - qDebug() << "执行Warp操作失败。"; - } - - // 清理资源 - GDALDestroyGenImgProjTransformer(psWO->pTransformerArg); - GDALDestroyWarpOptions(psWO); - GDALClose(srcDS); - GDALClose(dstDS); - - qDebug() << "重采样完成,结果已保存至:" << OutrasterCPath; -} - -void cropRasterByLatLon(const char* inputFile, const char* outputFile, double minLon, double maxLon, double minLat, double maxLat) { - // 初始化 GDAL 库 - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - // 打开栅格数据集 - GDALDataset* poDataset = (GDALDataset*)GDALOpen(inputFile, GA_ReadOnly); - if (poDataset == nullptr) { - qDebug() << "Failed to open input raster." ; - return; - } - - // 获取栅格数据的地理参考信息 - double adfGeoTransform[6]; - if (poDataset->GetGeoTransform(adfGeoTransform) != CE_None) { - qDebug() << "Failed to get geotransform." ; - GDALClose(poDataset); - return; - } - - // 获取输入影像的投影信息 - const char* projection = poDataset->GetProjectionRef(); - - // 根据经纬度计算出裁剪区域对应的栅格像素坐标 - int xMin = (int)((minLon - adfGeoTransform[0]) / adfGeoTransform[1]); - int xMax = (int)((maxLon - adfGeoTransform[0]) / adfGeoTransform[1]); - int yMin = (int)((maxLat - adfGeoTransform[3]) / adfGeoTransform[5]); - int yMax = (int)((minLat - adfGeoTransform[3]) / adfGeoTransform[5]); - - // 创建裁剪区域的目标栅格数据集 - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - if (poDriver == nullptr) { - qDebug() << "Failed to get GTiff driver." ; - GDALClose(poDataset); - return; - } - - // 创建输出栅格数据集,指定尺寸 - int width = xMax - xMin; - int height = yMax - yMin; - GDALDataset* poOutDataset = poDriver->Create(outputFile, width, height, poDataset->GetRasterCount(), GDT_Float32, nullptr); - if (poOutDataset == nullptr) { - qDebug() << "Failed to create output raster." ; - GDALClose(poDataset); - return; - } - - // 设置输出栅格的投影信息和地理变换 - poOutDataset->SetProjection(projection); - double newGeoTransform[6] = { adfGeoTransform[0] + xMin * adfGeoTransform[1], adfGeoTransform[1], 0.0, adfGeoTransform[3] + yMin * adfGeoTransform[5], 0.0, adfGeoTransform[5] }; - poOutDataset->SetGeoTransform(newGeoTransform); - - // 循环读取源数据并写入目标数据集 - for (int i = 0; i < poDataset->GetRasterCount(); ++i) { - GDALRasterBand* poBand = poDataset->GetRasterBand(i + 1); - GDALRasterBand* poOutBand = poOutDataset->GetRasterBand(i + 1); - - // 读取源数据 - int* pData = new int[width * height]; - poBand->RasterIO(GF_Read, xMin, yMin, width, height, pData, width, height, GDT_Int32, 0, 0); - - // 写入目标数据 - poOutBand->RasterIO(GF_Write, 0, 0, width, height, pData, width, height, GDT_Int32, 0, 0); - - delete[] pData; - } - - qDebug() << "Raster cropped and saved to: " << outputFile; - - // 清理 - - GDALClose((GDALDatasetH)(GDALDatasetH)poDataset); - GDALClose((GDALDatasetH)(GDALDatasetH)poOutDataset); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH -} - -ErrorCode transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG, Point2& p) { - // 创建源坐标系(原始坐标系) - OGRSpatialReference sourceSRS; - sourceSRS.importFromEPSG(sourceEPSG); // 使用 EPSG 编码来指定坐标系 - - // 创建目标坐标系(目标坐标系) - OGRSpatialReference targetSRS; - targetSRS.importFromEPSG(targetEPSG); // WGS84 坐标系 EPSG:4326 - - // 创建坐标变换对象 - OGRCoordinateTransformation* transform = OGRCreateCoordinateTransformation(&sourceSRS, &targetSRS); - if (transform == nullptr) { - qDebug() << "Failed to create coordinate transformation."; - return ErrorCode::FAIL; - } - - // 转换坐标 - double transformedX = x; - double transformedY = y; - if (transform->Transform(1, &transformedX, &transformedY)) { - qDebug() << "Original Coordinates: (" << x << ", " << y << ")"; - qDebug() << "Transformed Coordinates (EPSG:" << targetEPSG << "): (" << transformedX << ", " << transformedY << ")"; - } - else { - qDebug() << "Coordinate transformation failed."; - } - - // 清理 - delete transform; - p.x = transformedX; - p.y = transformedY; - return ErrorCode::SUCCESS; - -} - - -void transformRaster(const char* inputFile, const char* outputFile, int sourceEPSG, int targetEPSG) { - // 初始化 GDAL 库 - GDALAllRegister(); - - // 打开源栅格文件 - GDALDataset* poSrcDS = (GDALDataset*)GDALOpen(inputFile, GA_ReadOnly); - if (poSrcDS == nullptr) { - qDebug() << "Failed to open input file:" << inputFile; - return; - } - - // 获取源栅格的基本信息 - int nXSize = poSrcDS->GetRasterXSize(); - int nYSize = poSrcDS->GetRasterYSize(); - int nBands = poSrcDS->GetRasterCount(); - GDALDataType eDT = poSrcDS->GetRasterBand(1)->GetRasterDataType(); - - // 创建目标栅格文件 - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - if (poDriver == nullptr) { - qDebug() << "GTiff driver not available."; - GDALClose(poSrcDS); - return; - } - - GDALDataset* poDstDS = poDriver->Create(outputFile, nXSize, nYSize, nBands, eDT, nullptr); - if (poDstDS == nullptr) { - qDebug() << "Failed to create output file:" << outputFile; - GDALClose(poSrcDS); - return; - } - - // 设置目标栅格的空间参考系统 - OGRSpatialReference oSRS; - oSRS.importFromEPSG(targetEPSG); - - char* pszWKT = nullptr; - oSRS.exportToWkt(&pszWKT); - poDstDS->SetProjection(pszWKT); - CPLFree(pszWKT); - - // 复制元数据 - poDstDS->SetMetadata(poSrcDS->GetMetadata()); - - // 复制每个波段的数据 - for (int i = 1; i <= nBands; ++i) { - GDALRasterBand* poSrcBand = poSrcDS->GetRasterBand(i); - GDALRasterBand* poDstBand = poDstDS->GetRasterBand(i); - - float* pafScanline = (float*)CPLMalloc(sizeof(float) * nXSize); - - for (int j = 0; j < nYSize; ++j) { - poSrcBand->RasterIO(GF_Read, 0, j, nXSize, 1, pafScanline, nXSize, 1, GDT_Float32, 0, 0); - poDstBand->RasterIO(GF_Write, 0, j, nXSize, 1, pafScanline, nXSize, 1, GDT_Float32, 0, 0); - } - - CPLFree(pafScanline); - } - - // 关闭数据集 - GDALClose(poSrcDS); - GDALClose(poDstDS); - - qDebug() << "Raster transformation completed successfully."; -} - - -void resampleRaster(const char* inputRaster, const char* outputRaster, double targetPixelSizeX, double targetPixelSizeY) { - // 初始化GDAL - GDALAllRegister(); - // 打开输入栅格文件 - GDALDataset* poDataset = (GDALDataset*)GDALOpen(inputRaster, GA_ReadOnly); - if (poDataset == nullptr) { - qDebug() << "Failed to open raster file." ; - return; - } - - // 获取原始栅格的空间参考 - double adfGeoTransform[6]; - if (poDataset->GetGeoTransform(adfGeoTransform) != CE_None) { - qDebug() << "Failed to get geotransform." ; - GDALClose(poDataset); - return; - } - - // 获取原始栅格的尺寸 - int nXSize = poDataset->GetRasterXSize(); - int nYSize = poDataset->GetRasterYSize(); - - // 计算目标栅格的尺寸 - double targetXSize = ceil((adfGeoTransform[1] * nXSize) / targetPixelSizeX); - double targetYSize = ceil(std::abs((adfGeoTransform[5] * nYSize) / targetPixelSizeY)); - - // 创建目标数据集(输出栅格) - GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - if (poDriver == nullptr) { - qDebug() << "Failed to get GTiff driver." ; - GDALClose(poDataset); - return; - } - - // 设置输出数据集的地理变换(坐标系) - double targetGeoTransform[6] = { - adfGeoTransform[0], targetPixelSizeX, 0, adfGeoTransform[3], 0, -targetPixelSizeY - }; - GDALClose((GDALDatasetH)(GDALDatasetH)poDataset); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - ResampleGDAL(inputRaster, outputRaster, targetGeoTransform, targetXSize, targetYSize,GRA_Bilinear); - qDebug() << "Resampling completed."; -} - -std::shared_ptr GetCenterPointInRaster(QString filepath) -{ - qDebug() << "============= GetCenterPointInRaster ======================"; - // QTextCodec* codec = QTextCodec::codecForLocale(); // 获取系统默认编码的文本编解码器 - // QByteArray byteArray = codec->fromUnicode(filepath); // 将QString转换为QByteArray - //,这个应该会自动释放 const char* charArray = byteArray.constData(); // - // 获取QByteArray的const char*指针 - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - // qDebug()<GetGeoTransform(adfGeoTransform) != CE_None) { - qDebug() << "Failed to get GeoTransform"; - return nullptr; - } - - double dfWidth = poDataset->GetRasterXSize(); - double dfHeight = poDataset->GetRasterYSize(); - - // 计算中心点坐标(像素坐标) - double dfCenterX = adfGeoTransform[0] + dfWidth * adfGeoTransform[1] / 2.0 - + dfHeight * adfGeoTransform[2] / 2.0; - double dfCenterY = adfGeoTransform[3] + dfWidth * adfGeoTransform[4] / 2.0 - + dfHeight * adfGeoTransform[5] / 2.0; - - OGRSpatialReference oSRS; - oSRS.importFromWkt(poDataset->GetProjectionRef()); - - if (oSRS.IsGeographic()) { - qDebug() << "Center coords (already in geographic): (" + QString::number(dfCenterX) - + ", " + QString::number(dfCenterY) + ")"; - flag = true; - x = dfCenterX; - y = dfCenterY; - } - else { - // 如果不是地理坐标系,转换到WGS84 - OGRSpatialReference oSRS_WGS84; - oSRS_WGS84.SetWellKnownGeogCS("WGS84"); - - OGRCoordinateTransformation* poCT = - OGRCreateCoordinateTransformation(&oSRS, &oSRS_WGS84); - if (poCT == nullptr) { - qDebug() << "Failed to create coordinate transformation"; - return nullptr; - } - - // double dfLon, dfLat; - if (poCT->Transform(1, &dfCenterX, &dfCenterY)) { - qDebug() << "Center coords (transformed to WGS84): (" - + QString::number(dfCenterX) + ", " + QString::number(dfCenterY) - << ")"; - flag = true; - x = dfCenterX; - y = dfCenterY; - } - else { - qDebug() << "Transformation failed."; - } - OGRCoordinateTransformation::DestroyCT(poCT); - } - } - if (nullptr == poDataset || NULL == poDataset) {} - else { - GDALClose(poDataset); - } - - if (flag) { - std::shared_ptr RasterCenterPoint = std::make_shared(); - RasterCenterPoint->x = x; - RasterCenterPoint->y = y; - RasterCenterPoint->z = 0; - return RasterCenterPoint; - } - else { - return nullptr; - } -} - - - -long GetEPSGFromRasterFile(QString filepath) -{ - qDebug() << "============= GetEPSGFromRasterFile ======================"; - // QTextCodec* codec = QTextCodec::codecForLocale(); // 获取系统默认编码的文本编解码器 - // QByteArray byteArray = codec->fromUnicode(filepath); // 将QString转换为QByteArray - //,这个应该会自动释放 const char* charArray = byteArray.constData(); // - // 获取QByteArray的const char*指针 - - { - if (QFile(filepath).exists()) { - qDebug() << "info: the image found.\n"; - } - else { - return -1; - } - - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // 注册GDAL驱动 - // qDebug()<GetProjectionRef(); - - qDebug() << QString::fromUtf8(pszProjection); - - // 创建SpatialReference对象 - OGRSpatialReference oSRS; - if (oSRS.importFromWkt((char**)&pszProjection) != OGRERR_NONE) { - qDebug() << ("Error: Unable to import projection information.\n"); - GDALClose(poDataset); - return -1; - } - - qDebug() << pszProjection; - - const char* epscodestr = oSRS.GetAuthorityCode(nullptr); - if (NULL == epscodestr || nullptr == epscodestr) { - qDebug() << "EPSG code string could not be determined from the spatial reference."; - GDALClose(poDataset); - - return -1; - } - long epsgCode = atoi(epscodestr); // 获取EPSG代码 - - if (epsgCode != 0) { - GDALClose(poDataset); - qDebug() << QString("file %1 :epsg Code %2").arg(filepath).arg(epsgCode); - return epsgCode; - } - else { - qDebug() << "EPSG code could not be determined from the spatial reference."; - GDALClose(poDataset); - - return -1; - } - } -} - - - -long getProjectEPSGCodeByLon_Lat(double lon, double lat, ProjectStripDelta stripState) -{ - long EPSGCode = 0; - switch (stripState) { - case ProjectStripDelta::Strip_3: { - EPSGCode = getProjectEPSGCodeByLon_Lat_inStrip3(lon, lat); - break; - }; - case ProjectStripDelta::Strip_6: { - EPSGCode = getProjectEPSGCodeByLon_Lat_inStrip6(lon, lat); - break; - } - default: { - EPSGCode = -1; - break; - } - } - qDebug() << QString(" EPSG code : %1").arg(EPSGCode); - return EPSGCode; -} -long getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat) -{ - // EPSG 4534 ~ 4554 3 度带 - // 首先判断是否是在 中国带宽范围 - // 中心经度范围 :75E ~ 135E 实际范围 73.5E ~ 136.5E, - // 纬度范围 3N ~ 54N,放宽到 0N~ 60N - if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // 中国境内 - long code = trunc((lon - 73.5) / 3) + 4534; - return code; - } - else { // 非中国境内 使用 高斯克吕格 - bool isSouth = lat < 0; // 简单判断南北半球,这里仅为示例,实际应用可能需要更细致的逻辑 - long prefix = isSouth ? 327000 : 326000; - // std::string prefix = isSouth ? "327" : "326"; - lon = fmod(lon + 360.0, 360.0); - long zone = std::floor((lon + 180.0) / 3.0); - prefix = prefix + zone; - return prefix; - } - return 0; -} -long getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat) -{ - // EPSG 4502 ~ 4512 6度带 - // 首先判断是否是在 中国带宽范围 - // 中心经度范围 :75E ~ 135E 实际范围 72.0E ~ 138E, - // 纬度范围 3N ~ 54N,放宽到 0N~ 60N - if (73.5 <= lon && lon <= 136.5 && 0 <= lat && lat <= 60) { // 中国境内 - long code = trunc((lon - 72.0) / 6) + 4502; - return code; - } - else { // 非中国境内 使用 UTM// 确定带号,6度带从1开始到60,每6度一个带 - int zone = static_cast((lon + 180.0) / 6.0) + 1; - bool isSouth = lon < 0; // 判断是否在南半球 - long epsgCodeBase = isSouth ? 32700 : 32600; // 计算EPSG代码 - long prefix = static_cast(epsgCodeBase + zone); - return prefix; - } - return 0; -} - -QString GetProjectionNameFromEPSG(long epsgCode) -{ - qDebug() << "============= GetProjectionNameFromEPSG ======================"; - OGRSpatialReference oSRS; - - // 设置EPSG代码 - if (oSRS.importFromEPSG(epsgCode) != OGRERR_NONE) { - qDebug() << "epsgcode not recognition"; - return ""; - } - - // 获取并输出坐标系的描述(名称) - const char* pszName = oSRS.GetAttrValue("GEOGCS"); - if (pszName) { - qDebug() << "Coordinate system name for EPSG " + QString::number(epsgCode) - << " is: " + QString::fromStdString(pszName); - return QString::fromStdString(pszName); - } - else { - qDebug() << "Unable to retrieve the name for EPSG " + QString::number(epsgCode); - return ""; - } - - // char* wkt = NULL; - // // 转换为WKT格式 - // oSRS.exportToWkt(&wkt); - // - // qDebug() << wkt; - // - // // 从WKT中解析投影名称,这里简化处理,实际可能需要更复杂的逻辑来准确提取名称 - // std::string wktStr(wkt); - // long start = wktStr.find("PROJCS[\"") + 8; // 找到"PROJCS["后的第一个双引号位置 - // // 从start位置开始找下一个双引号,这之间的内容即为投影名称 - // int end = wktStr.find('\"', start); - // QString projName = QString::fromStdString(wktStr.substr(start, end - start)); - // - // // 释放WKT字符串内存 - // CPLFree(wkt); - - // return projName; -} - - - -CoordinateSystemType getCoordinateSystemTypeByEPSGCode(long epsg_code) -{ - OGRSpatialReference oSRS; - if (oSRS.importFromEPSG(epsg_code) == OGRERR_NONE) { - if (oSRS.IsGeographic()) { - return CoordinateSystemType::GeoCoordinateSystem; - } - else if (oSRS.IsProjected()) { - return CoordinateSystemType::ProjectCoordinateSystem; - } - else { - return CoordinateSystemType::UNKNOW; - } - } - else { - return CoordinateSystemType::UNKNOW; - } -} - - - -int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int new_width, - int new_height, GDALResampleAlg eResample) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO"); - GDALDataset* pDSrc = (GDALDataset*)GDALOpen(pszSrcFile, GA_ReadOnly); - if (pDSrc == NULL) { - return -1; - } - - GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - if (pDriver == NULL) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -2; - } - int width = pDSrc->GetRasterXSize(); - int height = pDSrc->GetRasterYSize(); - int nBandCount = pDSrc->GetRasterCount(); - GDALDataType dataType = pDSrc->GetRasterBand(1)->GetRasterDataType(); - - char* pszSrcWKT = NULL; - pszSrcWKT = const_cast(pDSrc->GetProjectionRef()); - - // 锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7 - if (strlen(pszSrcWKT) <= 0) { - OGRSpatialReference oSRS; - oSRS.importFromEPSG(4326); - // oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷 - // oSRS.SetWellKnownGeogCS("WGS84"); - oSRS.exportToWkt(&pszSrcWKT); - } - qDebug() << "GDALCreateGenImgProjTransformer " << Qt::endl; - void* hTransformArg; - hTransformArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, NULL, pszSrcWKT, - FALSE, 0.0, 1); - qDebug() << "no proj " << Qt::endl; - //(没锟斤拷投影锟斤拷影锟斤拷锟斤拷锟斤拷锟斤拷卟锟酵?拷锟?1锟?7) - if (hTransformArg == NULL) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -3; - } - qDebug() << "has proj " << Qt::endl; - double dGeoTrans[6] = { 0 }; - int nNewWidth = 0, nNewHeight = 0; - if (GDALSuggestedWarpOutput((GDALDatasetH)pDSrc, GDALGenImgProjTransform, hTransformArg, - dGeoTrans, &nNewWidth, &nNewHeight) - != CE_None) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -3; - } - - // GDALDestroyGenImgProjTransformer(hTransformArg); - qDebug() << "create init GDALDataset "; - GDALDataset* pDDst = - pDriver->Create(pszOutFile, new_width, new_height, nBandCount, dataType, NULL); - if (pDDst == NULL) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -2; - } - - pDDst->SetProjection(pszSrcWKT); - pDDst->SetGeoTransform(gt); - - GDALWarpOptions* psWo = GDALCreateWarpOptions(); - CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS"); // 使用所有可用的CPU核心 - CPLSetConfigOption("GDAL_CACHEMAX", "4000"); // 设置缓存大小为500MB - // psWo->papszWarpOptions = CSLDuplicate(NULL); - psWo->eWorkingDataType = dataType; - psWo->eResampleAlg = eResample; - - psWo->hSrcDS = (GDALDatasetH)pDSrc; - psWo->hDstDS = (GDALDatasetH)pDDst; - qDebug() << "GDALCreateGenImgProjTransformer" << Qt::endl; - psWo->pfnTransformer = GDALGenImgProjTransform; - psWo->pTransformerArg = GDALCreateGenImgProjTransformer( - (GDALDatasetH)pDSrc, pszSrcWKT, (GDALDatasetH)pDDst, pszSrcWKT, FALSE, 0.0, 1); - ; - - qDebug() << "GDALCreateGenImgProjTransformer has created" << Qt::endl; - psWo->nBandCount = nBandCount; - psWo->panSrcBands = (int*)CPLMalloc(nBandCount * sizeof(int)); - psWo->panDstBands = (int*)CPLMalloc(nBandCount * sizeof(int)); - for (int i = 0; i < nBandCount; i++) { - psWo->panSrcBands[i] = i + 1; - psWo->panDstBands[i] = i + 1; - } - - GDALWarpOperation oWo; - if (oWo.Initialize(psWo) != CE_None) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - return -3; - } - qDebug() << "ChunkAndWarpImage:" << new_width << "," << new_height << Qt::endl; - oWo.ChunkAndWarpMulti(0, 0, new_width, new_height); - GDALFlushCache(pDDst); - qDebug() << "ChunkAndWarpImage over" << Qt::endl; - // GDALDestroyGenImgProjTransformer(psWo->pTransformerArg); - // GDALDestroyWarpOptions(psWo); - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH - return 0; -} - -int ResampleGDALs(const char* pszSrcFile, int band_ids, GDALRIOResampleAlg eResample) -{ - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO"); - GDALDataset* pDSrc = (GDALDataset*)GDALOpen(pszSrcFile, GA_Update); - if (pDSrc == NULL) { - return -1; - } - - GDALDataType gdal_datatype = pDSrc->GetRasterBand(1)->GetRasterDataType(); - - GDALRasterBand* demBand = pDSrc->GetRasterBand(band_ids); - - int width = pDSrc->GetRasterXSize(); - int height = pDSrc->GetRasterYSize(); - int start_col = 0, start_row = 0, rows_count = 0, cols_count; - - int row_delta = int(120000000 / width); - - GDALRasterIOExtraArg psExtraArg; - INIT_RASTERIO_EXTRA_ARG(psExtraArg); - psExtraArg.eResampleAlg = eResample; - - do { - rows_count = start_row + row_delta < height ? row_delta : height - start_row; - cols_count = width; - - if (gdal_datatype == GDALDataType::GDT_UInt16) { - unsigned short* temp = new unsigned short[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, - cols_count, rows_count, gdal_datatype, 0, 0); - demBand->RasterIO(GF_Write, start_col, start_row, cols_count, rows_count, temp, - cols_count, rows_count, gdal_datatype, 0, 0, &psExtraArg); - delete[] temp; - - } - else if (gdal_datatype == GDALDataType::GDT_Int16) { - short* temp = new short[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, - cols_count, rows_count, gdal_datatype, 0, 0); - demBand->RasterIO(GF_Write, start_col, start_row, cols_count, rows_count, temp, - cols_count, rows_count, gdal_datatype, 0, 0, &psExtraArg); - delete[] temp; - } - else if (gdal_datatype == GDALDataType::GDT_Float32) { - float* temp = new float[rows_count * cols_count]; - demBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, temp, - cols_count, rows_count, gdal_datatype, 0, 0); - demBand->RasterIO(GF_Write, start_col, start_row, cols_count, rows_count, temp, - cols_count, rows_count, gdal_datatype, 0, 0, &psExtraArg); - delete[] temp; - } - start_row = start_row + rows_count; - } while (start_row < height); - GDALClose((GDALDatasetH)pDSrc); - - return 0; -} - -int alignRaster(QString inputPath, QString referencePath, QString outputPath, GDALResampleAlg eResample) -{ - - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - GDALDataset* pDSrc = (GDALDataset*)GDALOpen(inputPath.toUtf8().constData(), GA_ReadOnly); - if (pDSrc == NULL) { - return -1; - } - - GDALDataset* tDSrc = (GDALDataset*)GDALOpen(referencePath.toUtf8().constData(), GA_ReadOnly); - if (tDSrc == NULL) { - return -1; - } - - long new_width = tDSrc->GetRasterXSize(); - long new_height = tDSrc->GetRasterYSize(); - - GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); - if (pDriver == NULL) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -2; - } - int width = pDSrc->GetRasterXSize(); - int height = pDSrc->GetRasterYSize(); - int nBandCount = pDSrc->GetRasterCount(); - GDALDataType dataType = pDSrc->GetRasterBand(1)->GetRasterDataType(); - - char* pszSrcWKT = NULL; - pszSrcWKT = const_cast(pDSrc->GetProjectionRef()); - - if (strlen(pszSrcWKT) <= 0) { - OGRSpatialReference oSRS; - oSRS.importFromEPSG(4326); - oSRS.exportToWkt(&pszSrcWKT); - } - qDebug() << "GDALCreateGenImgProjTransformer " << Qt::endl; - void* hTransformArg; - hTransformArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, NULL, pszSrcWKT, FALSE, 0.0, 1); - qDebug() << "no proj " << Qt::endl; - if (hTransformArg == NULL) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -3; - } - qDebug() << "has proj " << Qt::endl; - std::shared_ptr dGeoTrans(new double[6], delArrPtr); - int nNewWidth = 0, - nNewHeight = 0; - - if (GDALSuggestedWarpOutput((GDALDatasetH)pDSrc, GDALGenImgProjTransform, hTransformArg, dGeoTrans.get(), &nNewWidth, &nNewHeight) != CE_None) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -3; - } - - GDALDataset* pDDst = pDriver->Create(outputPath.toUtf8().constData(), new_width, new_height, pDSrc->GetRasterCount(), dataType, NULL); - if (pDDst == NULL) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - return -2; - } - - std::shared_ptr gt(new double[6], delArrPtr); - tDSrc->GetGeoTransform(gt.get()); - pDDst->SetProjection(pszSrcWKT); - pDDst->SetGeoTransform(gt.get()); - - GDALWarpOptions* psWo = GDALCreateWarpOptions(); - - psWo->eWorkingDataType = dataType; - psWo->eResampleAlg = eResample; - - psWo->hSrcDS = (GDALDatasetH)pDSrc; - psWo->hDstDS = (GDALDatasetH)pDDst; - - psWo->pfnTransformer = GDALGenImgProjTransform; - psWo->pTransformerArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, (GDALDatasetH)pDDst, pszSrcWKT, FALSE, 0.0, 1); - - - qDebug() << "GDALCreateGenImgProjTransformer has created" << Qt::endl; - psWo->nBandCount = nBandCount; - psWo->panSrcBands = (int*)CPLMalloc(nBandCount * sizeof(int)); - psWo->panDstBands = (int*)CPLMalloc(nBandCount * sizeof(int)); - for (int i = 0; i < nBandCount; i++) { - psWo->panSrcBands[i] = i + 1; - psWo->panDstBands[i] = i + 1; - } - - GDALWarpOperation oWo; - if (oWo.Initialize(psWo) != CE_None) { - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALClose((GDALDatasetH)(GDALDatasetH)tDSrc); - return -3; - } - qDebug() << "ChunkAndWarpImage:" << new_width << "," << new_height << Qt::endl; - oWo.ChunkAndWarpMulti(0, 0, new_width, new_height); - GDALFlushCache(pDDst); - qDebug() << "ChunkAndWarpImage over" << Qt::endl; - GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); - GDALClose((GDALDatasetH)(GDALDatasetH)pDDst); - GDALClose((GDALDatasetH)(GDALDatasetH)tDSrc); - return 0; - - -} - - - -/** 2025.03.25 下面的函数存在 Eigen使用****************************/ - - - -bool saveEigenMatrixXd2Bin(Eigen::MatrixXd data, QString dataStrPath) -{ - - Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3); - - gdalImage img = CreategdalImageDouble(dataStrPath, data.rows(), data.cols(), 1, gt, "", false, true, true); - - img.saveImage(data, 0, 0, 1); - - return true; -} - - -Eigen::MatrixXd getGeoTranslationArray(QString in_path) -{ - return Eigen::MatrixXd(); -} - - -int saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path) -{ - int rows = data.rows(); - int cols = data.cols(); - - Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3); - - gdalImage image_tiff = - CreategdalImage(out_tiff_path, rows, cols, 2, gt, "", false, true); // 注意这里保留仿真结果 - // 保存二进制文件 - Eigen::MatrixXd real_img = data.array().real(); - Eigen::MatrixXd imag_img = data.array().imag(); - image_tiff.saveImage(real_img, 0, 0, 1); - image_tiff.saveImage(imag_img, 0, 0, 2); - return -1; -} - -void clipRaster(QString inRasterPath, QString outRasterPath, long minRow, long maxRow, long minCol, long maxCol) -{ - long rownum = maxRow - minRow + 1; - long colnum = maxCol - minCol + 1; - - gdalImage inimg(inRasterPath); - Eigen::MatrixXd gt = inimg.gt; - - Landpoint lp = inimg.getLandPoint(minRow, minCol, 0); - - gt(0, 0) = lp.lon; - gt(1, 0) = lp.lat; - - gdalImage outimg = CreategdalImageDouble(outRasterPath, rownum, colnum, inimg.band_num, gt, inimg.projection, true, true, true); - - for (long bi = 1; bi < inimg.band_num + 1; bi++) { - Eigen::MatrixXd brasterData = inimg.getData(minRow, minCol, rownum, colnum, bi); - outimg.saveImage(brasterData, 0, 0, bi); - qDebug() << "writer raster band : " << bi; - } - - qDebug() << "writer raster overring"; - -} - - - -ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QString demsloperPath) -{ - QString DEMPath = dempath; - QString XYZPath = demxyzpath; - QString SLOPERPath = demsloperPath; - - - - gdalImage demds(DEMPath); - gdalImage demxyz = CreategdalImageDouble(XYZPath, demds.height, demds.width, 3, demds.gt, demds.projection, true, true, false);// X,Y,Z - - // 分块计算并转换为XYZ - - //Eigen::MatrixXd demArr = demds.getData(0, 0, demds.height, demds.width, 1); - //Eigen::MatrixXd demR = demArr; - - double R = 0; - double dem_row = 0, dem_col = 0, dem_alt = 0; - - long line_invert = Memory1MB / 8.0 / demds.width * 1000; - - - - for (int max_rows_ids = 0; max_rows_ids < demds.height; max_rows_ids = max_rows_ids + line_invert) { - qDebug() << "dem -> XYZ [" << max_rows_ids*100.0/ demds.height << "] %" ; - - Eigen::MatrixXd demdata = demds.getData(max_rows_ids, 0, line_invert, demds.width, 1); - Eigen::MatrixXd xyzdata_x = demdata.array() * 0; - Eigen::MatrixXd xyzdata_y = demdata.array() * 0; - Eigen::MatrixXd xyzdata_z = demdata.array() * 0; - - int datarows = demdata.rows(); - int datacols = demdata.cols(); - -#pragma omp parallel for - for (int i = 0; i < datarows; i++) { - Landpoint LandP{ 0,0,0 }; - Point3 GERpoint{ 0,0,0 }; - double rowidx = 0; - double colidx = 0; - for (int j = 0; j < datacols; j++) { - rowidx = i + max_rows_ids; - colidx = j; - demds.getLandPoint(rowidx, colidx, demdata(i, j), LandP); // 获取地理坐标 - LLA2XYZ(LandP, GERpoint); // 经纬度转换为地心坐标系 - xyzdata_x(i, j) = GERpoint.x; - xyzdata_y(i, j) = GERpoint.y; - xyzdata_z(i, j) = GERpoint.z; - } - } - demxyz.saveImage(xyzdata_x, max_rows_ids, 0, 1); - demxyz.saveImage(xyzdata_y, max_rows_ids, 0, 2); - demxyz.saveImage(xyzdata_z, max_rows_ids, 0, 3); - - } - - - // 计算坡向角 - - - - gdalImage demsloperxyz = CreategdalImageDouble(SLOPERPath, demds.height, demds.width, 4, demds.gt, demds.projection, true, true, false);// X,Y,Z,cosangle - - line_invert = 1000; - long start_ids = 0; - long dem_rows = 0, dem_cols = 0; - for (start_ids = 1; start_ids < demds.height; start_ids = start_ids + line_invert) { - Eigen::MatrixXd demdata = demds.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 1); - long startlineid = start_ids; - - Eigen::MatrixXd demsloper_x = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 1); - Eigen::MatrixXd demsloper_y = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 2); - Eigen::MatrixXd demsloper_z = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 3); - Eigen::MatrixXd demsloper_angle = demsloperxyz.getData(start_ids - 1, 0, line_invert + 2, demxyz.width, 4); - - dem_rows = demsloper_x.rows(); - dem_cols = demsloper_x.cols(); - -#pragma omp parallel for - for (long i = 1; i < dem_rows - 1; i++) { - Landpoint p0, p1, p2, p3, p4, pslopeVector, pp; - Vector3D slopeVector; - double sloperAngle = 0; - Vector3D Zaxis = { 0,0,1 }; - - double rowidx = 0, colidx = 0; - for (long j = 1; j < dem_cols - 1; j++) { - rowidx = i + startlineid; - colidx = j; - demds.getLandPoint(rowidx, colidx, demdata(i, j), p0); - demds.getLandPoint(rowidx - 1, colidx, demdata(i - 1, j), p1); - demds.getLandPoint(rowidx, colidx - 1, demdata(i, j - 1), p2); - demds.getLandPoint(rowidx + 1, colidx, demdata(i + 1, j), p3); - demds.getLandPoint(rowidx, colidx + 1, demdata(i, j + 1), p4); - - pslopeVector = getSlopeVector(p0, p1, p2, p3, p4); // 地面坡向矢量 - slopeVector = { pslopeVector.lon,pslopeVector.lat,pslopeVector.ati }; - pp = LLA2XYZ(p0); - Zaxis.x = pp.lon; - Zaxis.y = pp.lat; - Zaxis.z = pp.ati; - sloperAngle = getCosAngle(slopeVector, Zaxis); // 地面坡向角 - - demsloper_x(i, j) = slopeVector.x; - demsloper_y(i, j) = slopeVector.y; - demsloper_z(i, j) = slopeVector.z; - demsloper_angle(i, j) = sloperAngle; - - } - } - - demsloperxyz.saveImage(demsloper_x, start_ids - 1, 0, 1); - demsloperxyz.saveImage(demsloper_y, start_ids - 1, 0, 2); - demsloperxyz.saveImage(demsloper_z, start_ids - 1, 0, 3); - demsloperxyz.saveImage(demsloper_angle, start_ids - 1, 0, 4); - - } - - - - return ErrorCode::SUCCESS; -} - - - -void CreateSARIntensityByLookTable(QString IntensityRasterPath, - QString LookTableRasterPath, - QString SARIntensityPath, - long min_rid, long max_rid, - long min_cid, long max_cid, - std::function processBarShow -) -{ - gdalImage looktableds(LookTableRasterPath); - gdalImage geoIntensity(IntensityRasterPath); - gdalImage SARIntensity = CreategdalImageDouble(SARIntensityPath, max_rid - min_rid, max_cid - min_cid, 1); - - long blockYSize = Memory1GB / looktableds.width / 8 * 2; - - Eigen::MatrixXd SARData = SARIntensity.getData(0, 0, SARIntensity.height, SARIntensity.width, 1); - SARData = SARData.array() * 0; - // 分块处理 - for (int yOff = 0; yOff < looktableds.height; yOff += blockYSize) - { - processBarShow(yOff, looktableds.height); - qDebug() << "Process : [" << yOff * 100.0 / looktableds.height << " % ]"; - Eigen::MatrixXd rowData = looktableds.getData(yOff, 0, blockYSize, looktableds.width, 1); - Eigen::MatrixXd colData = looktableds.getData(yOff, 0, blockYSize, looktableds.width, 2); - Eigen::MatrixXd geoData = geoIntensity.getData(yOff, 0, blockYSize, looktableds.width, 1); - - for (long i = 0; i < rowData.rows(); i++) { - for (long j = 0; j < rowData.cols(); j++) { - long r = round(rowData(i, j)) - min_rid; - long c = round(colData(i, j)) - min_cid; - - if (r >= 0 && r < SARIntensity.height && c >= 0 && c < SARIntensity.width) { - SARData(r, c) = SARData(r, c) + geoData(i, j); - } - } - } - } - SARIntensity.saveImage(SARData, 0, 0, 1); - qDebug() << "Process : [ 100 % ]"; - processBarShow(1000, 1000); -} - - - - - - - - -/**​ -* @brief 将VRT文件转换为ENVI格式(生成.dat和.hdr文件) -* @param inputVrtPath 输入VRT文件路径 -* @param outputEnviPath 输出ENVI数据文件路径(不含扩展名,自动生成.dat和.hdr) -* @param papszOptions GDAL创建选项(如压缩参数、存储顺序等,默认NULL) -* @return 成功返回true,失败返回false -*/ -bool ConvertVrtToEnvi(QString vrtPath, QString outPath) { - - GDALAllRegister(); - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); // 注绞斤拷斤拷锟?1锟?7 - CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); - - const char* inputVrtPath = vrtPath.toUtf8().constData(); - const char* outputEnviPath = outPath.toUtf8().constData(); - - // 注册所有GDAL驱动[7](@ref) - GDALAllRegister(); - - // 打开输入VRT文件[1,3](@ref) - GDALDataset* poVRTDataset = (GDALDataset*)GDALOpen(inputVrtPath, GA_ReadOnly); - if (!poVRTDataset) { - qDebug() << "错误:无法打开VRT文件 " << inputVrtPath ; - return false; - } - - // 获取ENVI驱动[4,7](@ref) - GDALDriver* poENVIDriver = GetGDALDriverManager()->GetDriverByName("ENVI"); - if (!poENVIDriver) { - qDebug() << "错误:ENVI驱动未加载" ; - GDALClose(poVRTDataset); - return false; - } - - // 构造输出文件名(强制添加.dat后缀)[4](@ref) - std::string outputPath = std::string(outputEnviPath) + ".dat"; - - // 执行格式转换(自动生成.hdr头文件)[4,7](@ref) - GDALDataset* poENVIDataset = poENVIDriver->CreateCopy( - outputPath.c_str(), // 输出路径 - poVRTDataset, // 输入数据集 - FALSE, // 非严格模式(允许格式调整) - nullptr, // 用户自定义选项(如压缩参数) - nullptr, nullptr // 进度条和参数(暂不启用) - ); - - // 检查转换结果 - bool success = (poENVIDataset != nullptr); - if (!success) { - qDebug() << "错误:ENVI文件创建失败" ; - } - else { - GDALClose(poENVIDataset); - } - - // 关闭输入数据集 - GDALClose(poVRTDataset); - return success; -} - - - - -// 遥感类 -ErrorCode ResampleDEM(QString indemPath, QString outdemPath, double gridx, double gridy) -{ - double gridlat = gridy / 110000.0; - double gridlon = gridx / 100000.0; - - long espgcode = GetEPSGFromRasterFile(indemPath.toUtf8().constData()); - if (espgcode == 4326) { - resampleRaster(indemPath.toUtf8().constData(), outdemPath.toUtf8().constData(), gridlon, gridlat); - return ErrorCode::SUCCESS; - } - else { - QMessageBox::warning(nullptr, u8"警告", u8"请输入WGS84坐标的DEM影像"); - return ErrorCode::FAIL; - } -} - -void BASECONSTVARIABLEAPI CloseAllGDALRaster() -{ - GDALDestroyDriverManager(); - return ; -} - - - -ErrorCode Complex2AmpRaster(QString inComplexPath, QString outRasterPath) -{ - gdalImageComplex inimg(inComplexPath); - gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true); - - long blocklines = Memory1GB * 2 / 8 / inimg.width; - blocklines = blocklines < 100 ? 100 : blocklines; - - long startrow = 0; - for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) { - - Eigen::MatrixXd imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1); - Eigen::MatrixXcd imgArr = inimg.getDataComplex(startrow, 0, blocklines, inimg.width, 1); - imgArrb1 = imgArr.array().abs(); - ampimg.saveImage(imgArrb1, startrow, 0, 1); - } - qDebug() << u8"影像写入到:" << outRasterPath; - return ErrorCode::SUCCESS; -} - -ErrorCode Complex2PhaseRaster(QString inComplexPath, QString outRasterPath) -{ - gdalImageComplex inimg(inComplexPath); - gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true); - - - long blocklines = Memory1GB * 2 / 8 / inimg.width; - blocklines = blocklines < 100 ? 100 : blocklines; - Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); - Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); - - long startrow = 0; - for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) { - - imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1); - imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 1); - imgArrb1 = imgArr.array().arg(); - ampimg.saveImage(imgArrb1, startrow, 0, 1); - } - qDebug() << "影像写入到:" << outRasterPath; - return ErrorCode::SUCCESS; -} - -ErrorCode Complex2dBRaster(QString inComplexPath, QString outRasterPath) -{ - gdalImageComplex inimg(inComplexPath); - gdalImage ampimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true); - - - long blocklines = Memory1GB * 2 / 8 / inimg.width; - blocklines = blocklines < 100 ? 100 : blocklines; - Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, ampimg.width); - Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, inimg.width); - - long startrow = 0; - for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) { - - imgArrb1 = ampimg.getData(startrow, 0, blocklines, inimg.width, 1); - imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 1); - imgArrb1 = imgArr.array().abs().log10() * 20.0; - ampimg.saveImage(imgArrb1, startrow, 0, 1); - } - qDebug() << "影像写入到:" << outRasterPath; - return ErrorCode::SUCCESS; -} - - - -ErrorCode BASECONSTVARIABLEAPI amp2dBRaster(QString inPath, QString outRasterPath) -{ - gdalImage inimg(inPath); - gdalImage dBimg = CreategdalImage(outRasterPath, inimg.height, inimg.width, inimg.band_num, inimg.gt, inimg.projection, true, true); - - long blocklines = Memory1GB * 2 / 8 / inimg.width; - blocklines = blocklines < 100 ? 100 : blocklines; - Eigen::MatrixXd imgArrdB = Eigen::MatrixXd::Zero(blocklines, dBimg.width); - Eigen::MatrixXd imgArr = Eigen::MatrixXd::Zero(blocklines, inimg.width); - - long startrow = 0; - for (startrow = 0; startrow < inimg.height; startrow = startrow + blocklines) { - - imgArrdB = dBimg.getData(startrow, 0, blocklines, inimg.width, 1); - imgArr = inimg.getData(startrow, 0, blocklines, inimg.width, 1); - imgArrdB = imgArr.array().log10() * 20.0; - dBimg.saveImage(imgArrdB, startrow, 0, 1); - } - qDebug() << "影像写入到:" << outRasterPath; - return ErrorCode::SUCCESS; -} - - - -void MultiLookRaster(QString inRasterPath, QString outRasterPath, long looklineNumrow, long looklineNumCol) -{ - gdalImage inRaster(inRasterPath); - - int outRows = inRaster.height / looklineNumrow; - int outCols = inRaster.width / looklineNumCol; - int bandnum = 1; - QString project = inRaster.projection; - Eigen::MatrixXd inRasterGt = inRaster.gt; - GDALDataType datetype = inRaster.getDataType(); - - gdalImage outRaster = CreategdalImage(outRasterPath, outRows, outCols, 1, inRasterGt, project, true, true, true, datetype); - - Eigen::MatrixXd inRasterArr = inRaster.getData(0, 0, inRaster.height, inRaster.width, 1); - Eigen::MatrixXd outRasterArr = outRaster.getData(0, 0, outRows, outCols, 1); - - - // 多视处理 -#pragma omp parallel for collapse(2) - for (int row = 0; row < outRows; ++row) { - for (int col = 0; col < outCols; ++col) { - // 计算输入矩阵的窗口位置[2,3](@ref) - const int inputRow = row * looklineNumrow; - const int inputCol = col * looklineNumCol; - - // 动态计算实际窗口大小(处理边界情况)[3](@ref) - const int actualRows = (row == outRows - 1) ? - (inRaster.height - inputRow) : looklineNumrow; - const int actualCols = (col == outCols - 1) ? - (inRaster.width - inputCol) : looklineNumCol; - - // 提取当前窗口数据块[7](@ref) - Eigen::MatrixXd window = inRasterArr.block(inputRow, inputCol, actualRows, actualCols); - - // 计算多视平均值(自动处理数据类型转换)[2,7](@ref) - double sum = 0.0; - if constexpr (std::is_integral_v) { - sum = window.cast().sum(); // 整型数据转换为双精度计算 - } - else { - sum = window.sum(); - } - outRasterArr(row, col) = sum / (actualRows * actualCols); - } - } - - // 可选:处理残留边界(当输入尺寸不是整数倍时) - if ((inRaster.height % looklineNumrow != 0) || (inRaster.width % looklineNumCol != 0)) { - // 底部边界处理[3](@ref) - const int residualRowStart = outRows * looklineNumrow; - const int residualRowSize = inRaster.height - residualRowStart; - if (residualRowSize > 0) { -#pragma omp parallel for - for (int col = 0; col < outCols; ++col) { - const int inputCol = col * looklineNumCol; - const int actualCols = (col == outCols - 1) ? - (inRaster.width - inputCol) : looklineNumCol; - - Eigen::MatrixXd window = inRasterArr.block(residualRowStart, inputCol, - residualRowSize, actualCols); - outRasterArr(outRows - 1, col) = window.mean(); - } - } - - // 右侧边界处理[3](@ref) - const int residualColStart = outCols * looklineNumCol; - const int residualColSize = inRaster.width - residualColStart; - if (residualColSize > 0) { -#pragma omp parallel for - for (int row = 0; row < outRows; ++row) { - const int inputRow = row * looklineNumrow; - const int actualRows = (row == outRows - 1) ? - (inRaster.height - inputRow) : looklineNumrow; - - Eigen::MatrixXd window = inRasterArr.block(inputRow, residualColStart, - actualRows, residualColSize); - outRasterArr(row, outCols - 1) = window.mean(); - } - } - } - - // 保存结果 - outRaster.saveImage(outRasterArr, 0, 0, 1); - -} - - - - - - - - - - - - - -/* 启动下面的函数,会导致编译器错误,可能与Eigen 库 本身的bug相关,不建议排查,太费时间,而且不一定能排查出来 -* -*** - -Eigen::Matrix ReadComplexMatrixData(int start_line, int width, int line_num, - std::shared_ptr rasterDataset, GDALDataType gdal_datatype) -{ - int band_num = rasterDataset->GetRasterCount(); - if (gdal_datatype == 0) { - return Eigen::Matrix(0, 0); - } - else if (gdal_datatype < 8) { - if (band_num != 2) { - return Eigen::Matrix(0, 0); - } - } - else if (gdal_datatype < 12) { - if (band_num != 1) { - return Eigen::Matrix(0, 0); - } - - } - else { - } - bool _flag = false; - Eigen::Matrix data_mat( - line_num * width, 2); // 必须强制行优先 - if (gdal_datatype == GDT_Byte) { - Eigen::MatrixX real_mat(line_num * width, 1); - Eigen::MatrixX imag_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, gdal_datatype, - 0, 0); // real - rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - imag_mat.data(), width, line_num, gdal_datatype, - 0, 0); // imag - data_mat.col(0) = (real_mat.array().cast()).array(); - data_mat.col(1) = (imag_mat.array().cast()).array(); - _flag = true; - } - else if (gdal_datatype == GDT_UInt16) { - Eigen::MatrixX real_mat(line_num * width, 1); - Eigen::MatrixX imag_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, gdal_datatype, - 0, 0); // real - rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - imag_mat.data(), width, line_num, gdal_datatype, - 0, 0); // imag - data_mat.col(0) = (real_mat.array().cast()).array(); - data_mat.col(1) = (imag_mat.array().cast()).array(); - _flag = true; - } - else if (gdal_datatype == GDT_Int16) { - Eigen::MatrixX real_mat(line_num * width, 1); - Eigen::MatrixX imag_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, gdal_datatype, - 0, 0); // real - rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - imag_mat.data(), width, line_num, gdal_datatype, - 0, 0); // imag - data_mat.col(0) = (real_mat.array().cast()).array(); - data_mat.col(1) = (imag_mat.array().cast()).array(); - _flag = true; - } - else if (gdal_datatype == GDT_UInt32) { - Eigen::MatrixX real_mat(line_num * width, 1); - Eigen::MatrixX imag_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, gdal_datatype, - 0, 0); // real - rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - imag_mat.data(), width, line_num, gdal_datatype, - 0, 0); // imag - data_mat.col(0) = (real_mat.array().cast()).array(); - data_mat.col(1) = (imag_mat.array().cast()).array(); - _flag = true; - } - else if (gdal_datatype == GDT_Int32) { - Eigen::MatrixX real_mat(line_num * width, 1); - Eigen::MatrixX imag_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, gdal_datatype, - 0, 0); // real - rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - imag_mat.data(), width, line_num, gdal_datatype, - 0, 0); // imag - data_mat.col(0) = (real_mat.array().cast()).array(); - data_mat.col(1) = (imag_mat.array().cast()).array(); - _flag = true; - } - // else if (gdal_datatype == GDT_UInt64) { - // Eigen::MatrixX real_mat(line_num * width, 1); - // Eigen::MatrixX imag_mat(line_num * width, 1); - // rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - //real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real - // rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - //imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag data_mat.col(0) = - //(real_mat.array().cast()).array(); data_mat.col(1) = - //(imag_mat.array().cast()).array(); _flag = true; - // } - // else if (gdal_datatype == GDT_Int64) { - // Eigen::MatrixX real_mat(line_num * width, 1); - // Eigen::MatrixX imag_mat(line_num * width, 1); - // rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - //real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real - // rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - //imag_mat.data(), width, line_num, gdal_datatype, 0, 0); // imag data_mat.col(0) = - //(real_mat.array().cast()).array(); data_mat.col(1) = - //(imag_mat.array().cast()).array(); _flag = true; - // } - else if (gdal_datatype == GDT_Float32) { - Eigen::MatrixX real_mat(line_num * width, 1); - Eigen::MatrixX imag_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, gdal_datatype, - 0, 0); // real - rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - imag_mat.data(), width, line_num, gdal_datatype, - 0, 0); // imag - data_mat.col(0) = (real_mat.array().cast()).array(); - data_mat.col(1) = (imag_mat.array().cast()).array(); - _flag = true; - } - else if (gdal_datatype == GDT_Float64) { - Eigen::MatrixX real_mat(line_num * width, 1); - Eigen::MatrixX imag_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, gdal_datatype, - 0, 0); // real - rasterDataset->GetRasterBand(2)->RasterIO(GF_Read, 0, start_line, width, line_num, - imag_mat.data(), width, line_num, gdal_datatype, - 0, 0); // imag - data_mat.col(0) = (real_mat.array().cast()).array(); - data_mat.col(1) = (imag_mat.array().cast()).array(); - _flag = true; - } - else if (gdal_datatype == GDT_CInt16) { - Eigen::MatrixX> complex_short_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - complex_short_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = (complex_short_mat.real().array().cast()).array(); - data_mat.col(1) = (complex_short_mat.imag().array().cast()).array(); - _flag = true; - } - else if (gdal_datatype == GDT_CInt32) { - Eigen::MatrixX> complex_short_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - complex_short_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = (complex_short_mat.real().array().cast()).array(); - data_mat.col(1) = (complex_short_mat.imag().array().cast()).array(); - _flag = true; - } - else if (gdal_datatype == GDT_CFloat32) { - Eigen::MatrixX> complex_short_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - complex_short_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = (complex_short_mat.real().array().cast()).array(); - data_mat.col(1) = (complex_short_mat.imag().array().cast()).array(); - _flag = true; - } - else if (gdal_datatype == GDT_CFloat64) { - Eigen::MatrixX> complex_short_mat(line_num * width, 1); - rasterDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, start_line, width, line_num, - complex_short_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = (complex_short_mat.real().array().cast()).array(); - data_mat.col(1) = (complex_short_mat.imag().array().cast()).array(); - _flag = true; - } - else { - } - // 保存数据 - - if (_flag) { - return data_mat; - } - else { - return Eigen::Matrix( - 0, 0); // 必须强制行优先; - } -} - -Eigen::Matrix -ReadMatrixDoubleData(int start_line, int width, int line_num, - std::shared_ptr rasterDataset, GDALDataType gdal_datatype, - int band_idx) -{ - // 构建矩阵块,使用eigen 进行矩阵计算,加速计算 - bool _flag = false; - Eigen::Matrix data_mat( - line_num * width, 1); // 必须强制行优先 - if (gdal_datatype == GDT_Byte) { - Eigen::MatrixX real_mat(line_num * width, 1); - rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = ((real_mat.array().cast()).array().pow(2)).log10() * 10.0; - _flag = true; - } - else if (gdal_datatype == GDT_UInt16) { - Eigen::MatrixX real_mat(line_num * width, 1); - rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = ((real_mat.array().cast()).array().pow(2)).log10() * 10.0; - _flag = true; - } - else if (gdal_datatype == GDT_Int16) { - Eigen::MatrixX real_mat(line_num * width, 1); - rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = ((real_mat.array().cast()).array().pow(2)).log10() * 10.0; - _flag = true; - } - else if (gdal_datatype == GDT_UInt32) { - Eigen::MatrixX real_mat(line_num * width, 1); - rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = ((real_mat.array().cast()).array().pow(2)).log10() * 10.0; - _flag = true; - } - else if (gdal_datatype == GDT_Int32) { - Eigen::MatrixX real_mat(line_num * width, 1); - rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = ((real_mat.array().cast()).array().pow(2)).log10() * 10.0; - _flag = true; - } - // else if (gdal_datatype == GDT_UInt64) { - // Eigen::MatrixX real_mat(line_num * width, 1); - // rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - //real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real data_mat.col(0) = - //((real_mat.array().cast()).array().pow(2)).log10() * 10.0; _flag = true; - // } - // else if (gdal_datatype == GDT_Int64) { - // Eigen::MatrixX real_mat(line_num * width, 1); - // rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - //real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real data_mat.col(0) = - //((real_mat.array().cast()).array().pow(2)).log10() * 10.0; _flag = true; - // } - else if (gdal_datatype == GDT_Float32) { - Eigen::MatrixX real_mat(line_num * width, 1); - rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = ((real_mat.array().cast()).array().pow(2)).log10() * 10.0; - _flag = true; - } - else if (gdal_datatype == GDT_Float64) { - Eigen::MatrixX real_mat(line_num * width, 1); - rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, - real_mat.data(), width, line_num, - gdal_datatype, 0, 0); // real - data_mat.col(0) = ((real_mat.array().cast()).array().pow(2)).log10() * 10.0; - _flag = true; - } - else { - } - - return data_mat; -} - - -****/ diff --git a/BaseCommonLibrary/ShowProessAbstract.h b/BaseCommonLibrary/ShowProessAbstract.h deleted file mode 100644 index 957b9b0..0000000 --- a/BaseCommonLibrary/ShowProessAbstract.h +++ /dev/null @@ -1,15 +0,0 @@ - -#ifndef __SHOWPROCESSABSTRACT_H__ -#define __SHOWPROCESSABSTRACT_H__ -#include "BaseConstVariable.h" -#include - - -class BASECONSTVARIABLEAPI ShowProessAbstract { - -public: - virtual void showProcess(double precent, QString tip); - virtual void showToolInfo(QString tip); -}; - -#endif \ No newline at end of file diff --git a/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp b/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp deleted file mode 100644 index a20a9c5..0000000 --- a/BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "QToolAbstract.h" - -QToolAbstract::QToolAbstract(QObject* parent) -:QObject(parent) -{ - -} - -QToolAbstract::~QToolAbstract() -{ - -} - -void QToolAbstract::setToolXpath(QVector intoolPath) -{ - this->toolPath = intoolPath; -} - -void QToolAbstract::setToolName(QString intoolname) -{ - this->toolname = intoolname; -} - -QVector QToolAbstract::getToolXpath() -{ - return this->toolPath; -} - -QString QToolAbstract::getToolName() -{ - return this->toolname; -} - -void QToolAbstract::excute() -{ - this->run(); -} - -void QToolAbstract::run() -{ -} diff --git a/BaseCommonLibrary/ToolAbstract/QToolAbstract.h b/BaseCommonLibrary/ToolAbstract/QToolAbstract.h deleted file mode 100644 index fda74f6..0000000 --- a/BaseCommonLibrary/ToolAbstract/QToolAbstract.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once -#ifndef QToolAbstract_H_ -#define QToolAbstract_H_ - -#include "BaseConstVariable.h" -#include -#include -#include -#include -#include -#include -#include - - -// Զ QTreeWidgetItem ̳ -class BASECONSTVARIABLEAPI QToolAbstract : public QObject { - Q_OBJECT -public: - QToolAbstract(QObject* parent=nullptr); - ~QToolAbstract(); -public slots: - virtual void excute(); - virtual void setToolXpath(QVector toolPath); - virtual void setToolName(QString toolname); - virtual QVector getToolXpath(); - virtual QString getToolName(); -public: - QVector toolPath; - QString toolname; -public: - virtual void run(); -}; - -/* -// עṤ -PluginTool_*.dll -void RegisterPreToolBox(RasterProcessTool* mainWindows); -extern "C" void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows,ToolBoxWidget* toolbox); -*/ -#endif // !1 \ No newline at end of file diff --git a/BaseCommonLibrary/dllmain.cpp b/BaseCommonLibrary/dllmain.cpp deleted file mode 100644 index daed8c8..0000000 --- a/BaseCommonLibrary/dllmain.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// dllmain.cpp : 定义 DLL 应用程序的入口点。 -#include "pch.h" - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - diff --git a/BaseCommonLibrary/framework.h b/BaseCommonLibrary/framework.h deleted file mode 100644 index 80cbbc9..0000000 --- a/BaseCommonLibrary/framework.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容 -// Windows 头文件 -#include diff --git a/BaseCommonLibrary/pch.cpp b/BaseCommonLibrary/pch.cpp deleted file mode 100644 index b6fb8f4..0000000 --- a/BaseCommonLibrary/pch.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// pch.cpp: 与预编译标头对应的源文件 - -#include "pch.h" - -// 当使用预编译的头时,需要使用此源文件,编译才能成功。 diff --git a/BaseCommonLibrary/pch.h b/BaseCommonLibrary/pch.h deleted file mode 100644 index 9660927..0000000 --- a/BaseCommonLibrary/pch.h +++ /dev/null @@ -1,13 +0,0 @@ -// pch.h: 这是预编译标头文件。 -// 下方列出的文件仅编译一次,提高了将来生成的生成性能。 -// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。 -// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。 -// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。 - -#ifndef PCH_H -#define PCH_H - -// 添加要在此处预编译的标头 -#include "framework.h" - -#endif //PCH_H diff --git a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp b/GF3CalibrationAndOrthLib/GF3CalibrationAndGeocodingClass.cpp similarity index 68% rename from Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp rename to GF3CalibrationAndOrthLib/GF3CalibrationAndGeocodingClass.cpp index aadbd71..c4e2164 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.cpp +++ b/GF3CalibrationAndOrthLib/GF3CalibrationAndGeocodingClass.cpp @@ -7,6 +7,12 @@ #include #include #include +#include "BaseTool.h" +#include "GeoOperator.h" +#include "ImageOperatorBase.h" +#include "FileOperator.h" +#include "GF3Util.h" +#include "GF3CalibrationAndOrthLib.h" ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, double Qualifyvalue, double calibrationConst) { @@ -18,25 +24,29 @@ ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, doub gdalImageComplex outraster(outRasterPath); - long blocklines = Memory1GB * 2 / 8 / imgraster.width; + long blocklines = Memory1MB / 8 / imgraster.width*200; blocklines = blocklines < 100 ? 100 : blocklines; - Eigen::MatrixXd imgArrb1 = Eigen::MatrixXd::Zero(blocklines, imgraster.width); - Eigen::MatrixXd imgArrb2 = Eigen::MatrixXd::Zero(blocklines, imgraster.width); - Eigen::MatrixXcd imgArr = Eigen::MatrixXcd::Zero(blocklines, imgraster.width); double quayCoff = Qualifyvalue * 1.0 / 32767; double caliCoff = std::pow(10.0, (calibrationConst * 1.0 / 20)); qDebug() << u8"ϵ:\t" << quayCoff / caliCoff; - long startrow = 0; - for (startrow = 0; startrow < imgraster.height; startrow = startrow + blocklines) { + - imgArrb1 = imgraster.getData(startrow, 0, blocklines, imgraster.width, 1); - imgArrb2 = imgraster.getData(startrow, 0, blocklines, imgraster.width, 2); - imgArr = outraster.getDataComplex(startrow, 0, blocklines, outraster.width, 1); + omp_lock_t lock; + omp_init_lock(&lock); +#pragma omp parallel for + for (int64_t startrow = 0; startrow < imgraster.height; startrow = startrow + blocklines) { + + Eigen::MatrixXd imgArrb1 = imgraster.getData(startrow, 0, blocklines, imgraster.width, 1); + Eigen::MatrixXd imgArrb2 = imgraster.getData(startrow, 0, blocklines, imgraster.width, 2); + Eigen::MatrixXcd imgArr = outraster.getDataComplex(startrow, 0, blocklines, outraster.width, 1); imgArr.real() = imgArrb1.array() * quayCoff / caliCoff; imgArr.imag() = imgArrb2.array() * quayCoff / caliCoff; + omp_set_lock(&lock); outraster.saveImage(imgArr, startrow, 0, 1); + omp_unset_lock(&lock); // } + omp_destroy_lock(&lock); // qDebug() << u8"Ӱд뵽" << outRasterPath; return ErrorCode::SUCCESS; } @@ -246,13 +256,15 @@ ErrorCode RD_PSTN(double& refrange, double& lamda, double& timeR, double& R, dou inct = dt*(dplerTheory2-dplerNumber1) / (dplerTheory2 - dplerTheory1); if (std::abs(dplerNumber1 - dplerTheory2) < 1e-6 || std::abs(inct) < 1.0e-4) { + R = R1; // б + return ErrorCode::SUCCESS; break; } inct = std::abs(inct) < 10 ?inct:inct*1e-2; timeR = timeR - inct; } - R = R1; // б - return ErrorCode::SUCCESS; + return ErrorCode::FAIL; + } ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString outworkdir, QString outlooktablePath,QString outLocalIncidenceAnglePath,bool localincAngleFlag) @@ -398,7 +410,7 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out } } } - + // omp_set_lock(&lock); rasterRC.saveImage(sar_r, startRId, 0, 1); @@ -406,7 +418,6 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out omp_unset_lock(&lock); - Eigen::MatrixXd Angle_Arr = Eigen::MatrixXd::Zero(dem_x.rows(),dem_x.cols()).array()+181; if (localincAngleFlag) { Eigen::MatrixXd demslope_x = demslope.getData(startRId, 0, blockline, colcount, 1); @@ -429,7 +440,6 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out bool antflag = false; - for (long j = 0; j < blockcols; j++) { timeR = sar_r(i, j) / prf; slopex = demslope_x(i, j); @@ -446,7 +456,7 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out R = std::sqrt(Rst_x*Rst_x+Rst_y*Rst_y+Rst_z*Rst_z); slopeR = std::sqrt(slopex*slopex + slopey * slopey + slopez * slopez); localangle = ((slopex * Rst_x) + (slopey * Rst_y) + (slopez * Rst_z)); - localangle = std::acos(localangle / R/slopeR)*r2d; + localangle = std::acos(localangle / R/slopeR)*r2d; // Ƕ Angle_Arr(i, j) = localangle; } } @@ -458,9 +468,7 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out localincangleRaster.saveImage(Angle_Arr, startRId, 0, 1); } else {} - omp_unset_lock(&lock); - } @@ -483,7 +491,6 @@ ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString out ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString outRasterPath) { - gdalImage slcRaster(inRasterPath);// gdalImage looktableRaster(inlooktablePath);// gdalImage outRaster = CreategdalImage(outRasterPath, looktableRaster.height, looktableRaster.width, 1, looktableRaster.gt, looktableRaster.projection, true, true);// X,Y,Z @@ -494,60 +501,67 @@ ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString out return ErrorCode::FAIL; } - Eigen::MatrixXd slcImg = slcRaster.getData(0, 0, slcRaster.height, slcRaster.width, 1); - Eigen::MatrixXd sar_r = looktableRaster.getData(0, 0, looktableRaster.height, looktableRaster.width, 1); - Eigen::MatrixXd sar_c = looktableRaster.getData(0, 0, looktableRaster.height, looktableRaster.width, 2); - Eigen::MatrixXd outImg = outRaster.getData(0, 0, outRaster.height, outRaster.width, 1); + // ֵֿ + long blockline = Memory1MB / looktableRaster.width / 8 * 200;//300M + blockline = blockline < 1 ? 1 : blockline; - long lookRows = sar_r.rows(); - long lookCols = sar_r.cols(); + int64_t allcount = 0; +#pragma omp parallel for + for (long startrowid = 0; startrowid < looktableRaster.height; startrowid = startrowid + blockline) { + long tempblockline = startrowid + blockline < looktableRaster.height ? blockline : looktableRaster.height - startrowid; + Eigen::MatrixXd sar_r = looktableRaster.getData(startrowid, 0, tempblockline, looktableRaster.width, 1); + Eigen::MatrixXd sar_c = looktableRaster.getData(startrowid, 0, tempblockline, looktableRaster.width, 2); - long slcRows = slcImg.rows(); - long slcCols = slcImg.cols(); + int64_t slc_min_rid = sar_r.array().minCoeff(); + int64_t slc_max_rid = sar_r.array().maxCoeff(); - long lastr = 0; - long nextr = 0; - long lastc = 0; - long nextc = 0; - double Bileanervalue = 0; - // ֵ - Landpoint p0{ 0,0,0 }, p11{ 0,0,0 }, p21{ 0,0,0 }, p12{ 0,0,0 }, p22{ 0,0,0 }, p{ 0,0,0 }; + int64_t slc_r_len = slc_max_rid - slc_min_rid+1; + slc_min_rid = slc_min_rid < 0 ? 0 : slc_min_rid-1; + slc_r_len = slc_r_len + 2; + Eigen::MatrixXd slcImg = slcRaster.getData(slc_min_rid, 0, slc_r_len, slcRaster.width, 1); + Eigen::MatrixXd outImg = outRaster.getData(startrowid, 0, tempblockline, outRaster.width, 1); + + long lastr = 0; + long nextr = 0; + long lastc = 0; + long nextc = 0; + double Bileanervalue = 0; + // ֵ + Landpoint p0{ 0,0,0 }, p11{ 0,0,0 }, p21{ 0,0,0 }, p12{ 0,0,0 }, p22{ 0,0,0 }, p{ 0,0,0 }; - QProgressDialog progressDialog(u8"ͼ", u8"ֹ", 0, lookRows); - progressDialog.setWindowTitle(u8"ͼ"); - progressDialog.setWindowModality(Qt::WindowModal); - progressDialog.setAutoClose(true); - progressDialog.setValue(0); - progressDialog.setMaximum(lookRows); - progressDialog.setMinimum(0); - progressDialog.show(); + long lookRows = sar_r.rows(); + long lookCols = sar_r.cols(); - for (long i = 0; i < lookRows; i++) { - for (long j = 0; j < lookCols; j++) { + long slcRows = slcImg.rows(); + long slcCols = slcImg.cols(); - lastr = std::floor(sar_r(i, j)); - nextr = std::ceil(sar_r(i, j)); - lastc = std::floor(sar_c(i, j)); - nextc = std::ceil(sar_c(i, j)); - if (lastr < 0 || lastc < 0 || nextr >= slcRows || nextc >= slcCols) { - continue; + for (long i = 0; i < lookRows; i++) { + for (long j = 0; j < lookCols; j++) { + p0 = { sar_c(i,j) - lastc, sar_r(i,j) - lastr,0 }; + lastr = std::floor(sar_r(i, j)); + nextr = std::ceil(sar_r(i, j)); + lastc = std::floor(sar_c(i, j)); + nextc = std::ceil(sar_c(i, j)); + lastr = lastr - slc_min_rid; + nextr = nextr - slc_min_rid; + if (lastr < 0 || lastc < 0 || nextr >= slcRows || nextc >= slcCols) { + continue; + } + p11 = Landpoint{ 0,0,slcImg(lastr,lastc) }; + p21 = Landpoint{ 0,1,slcImg(nextr,lastc) }; + p12 = Landpoint{ 1,0,slcImg(lastr,nextc) }; + p22 = Landpoint{ 1,1,slcImg(nextr,nextc) }; + + Bileanervalue = Bilinear_interpolation(p0, p11, p21, p12, p22); + outImg(i, j) = Bileanervalue; } - - p0 = { sar_c(i,j)-lastc, sar_r(i,j)-lastr,0 }; - p11 = Landpoint{ 0,0,slcImg(lastr,lastc) }; - p21 = Landpoint{ 0,1,slcImg(nextr,lastc) }; - p12 = Landpoint{ 1,0,slcImg(lastr,nextc) }; - p22 = Landpoint{ 1,1,slcImg(nextr,nextc) }; - - Bileanervalue = Bilinear_interpolation(p0, p11, p21, p12, p22); - outImg(i, j) = Bileanervalue; - } - progressDialog.setValue(i); + } + + outRaster.saveImage(outImg, startrowid, 0, 1); + allcount = allcount + tempblockline; } - outRaster.saveImage(outImg, 0, 0, 1); - progressDialog.close(); - return ErrorCode::SUCCESS; + return ErrorCode::SUCCESS; } ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, double gridx, double gridy) @@ -556,8 +570,8 @@ ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, l1dataset.Open(inxmlPath); DemBox box = l1dataset.getExtend(); - double dlon = 0.1 * (box.max_lon - box.min_lon); - double dlat = 0.1 * (box.max_lat - box.min_lat); + double dlon = 0.2 * (box.max_lon - box.min_lon); + double dlat = 0.2 * (box.max_lat - box.min_lat); double minlat = box.min_lat - dlat; double minlon = box.min_lon - dlon; @@ -572,8 +586,8 @@ ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, long sourceespgcode = getProjectEPSGCodeByLon_Lat(centerlon, centerlat); long demespgcode = GetEPSGFromRasterFile(indemPath); double grid_resolution = gridx < gridy ? gridx : gridy; - double degreePerPixelX = grid_resolution / 110000.0; - double degreePerPixelY = grid_resolution / 110000.0; + double degreePerPixelX = getPixelSpacingInDegree(grid_resolution); + double degreePerPixelY = getPixelSpacingInDegree(grid_resolution); bool meter2degreeflag = ConvertResolutionToDegrees( sourceespgcode, grid_resolution, @@ -584,8 +598,8 @@ ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, ); if (!meter2degreeflag) { qDebug() << u8"תֱΪγʧ"; - degreePerPixelX = grid_resolution / 110000.0; - degreePerPixelY = grid_resolution / 110000.0; + degreePerPixelX = getPixelSpacingInDegree(grid_resolution); + degreePerPixelY = getPixelSpacingInDegree(grid_resolution); } qDebug() << u8"DEMӰΧ:"; qDebug() << u8"ֱʣ"< + + +// ݶ +ErrorCode GF3CALIBRATIONANDORTHLIB_EXPORT GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, double Qualifyvalue, double calibrationConst); + +ErrorCode GF3CALIBRATIONANDORTHLIB_EXPORT ImportGF3L1ARasterToWorkspace(QString inMetaxmlPath,QString inRasterPath, QString outWorkDirPath, POLARTYPEENUM polsartype); + +QVector GF3CALIBRATIONANDORTHLIB_EXPORT SearchGF3DataTiff(QString inMetaxmlPath); + +POLARTYPEENUM GF3CALIBRATIONANDORTHLIB_EXPORT getDatasetGF3FilePolsarType(QString fileName); + +ErrorCode GF3CALIBRATIONANDORTHLIB_EXPORT ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath); + +// RD 㷨 +ErrorCode GF3CALIBRATIONANDORTHLIB_EXPORT RD_PSTN(double& refrange,double& lamda, double& timeR, double& R, double& tx, double& ty, double& tz, double& slopex, double& slopey, double& slopez, GF3PolyfitSatelliteOribtModel& polyfitmodel, SatelliteOribtNode& node,double& d0,double& d1, double& d2, double& d3, double& d4); + +//ұ +ErrorCode GF3CALIBRATIONANDORTHLIB_EXPORT GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString outworkdir, QString outlooktablePath, QString outLocalIncidenceAnglePath, bool localincAngleFlag=false); +ErrorCode GF3CALIBRATIONANDORTHLIB_EXPORT GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString outRasterPath); + +// 䴦 +ErrorCode GF3CALIBRATIONANDORTHLIB_EXPORT GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, double gridx, double gridy); + + +// +У +ErrorCode GF3CALIBRATIONANDORTHLIB_EXPORT GF3MainOrthProcess(QString inDEMPath, QString inTarFilepath, QString outworkspacefolderpath, double pixelresultionDegreee, bool excutehh2vv = false); + + + +#endif \ No newline at end of file diff --git a/GF3CalibrationAndOrthLib/GF3CalibrationAndOrthLib.cpp b/GF3CalibrationAndOrthLib/GF3CalibrationAndOrthLib.cpp new file mode 100644 index 0000000..5bab439 --- /dev/null +++ b/GF3CalibrationAndOrthLib/GF3CalibrationAndOrthLib.cpp @@ -0,0 +1,96 @@ +#include "GF3CalibrationAndOrthLib.h" +#include "BaseConstVariable.h" +#include "RasterToolBase.h" +#include "ImageOperatorBase.h" +#include +#include +#include +#include "FileOperator.h" +#include "GPUBaseTool.h" +#include "GPUTool.cuh" +#include +// GPUصĴ +#include "GF3CalibrationGeoCodingFunCUDA.cuh" + +/// +/// HHתΪVV +/// +/// +/// +/// +/// +int GF3_Sigma0_HH2VV(QString in_SigmaHHRasterPath, QString in_IncidencAngleRasterPath, QString out_SigmaVVRasterPath, SIGMATYPE sigmatype) +{ + // step 1 Ϸ + { + // 1. Ϸ + if (in_SigmaHHRasterPath.isEmpty() || in_IncidencAngleRasterPath.isEmpty() || out_SigmaVVRasterPath.isEmpty()) + { + qDebug() << "Input or output file path is empty."; + throw std::invalid_argument("Input or output file path is empty."); + return 1; // ļ·Ϊ + } + // 2. ӰǷ + if (!QFile::exists(in_SigmaHHRasterPath) || !QFile::exists(in_IncidencAngleRasterPath)) + { + qDebug() << "Input file does not exist."; + throw std::runtime_error("Input file does not exist."); + return 2; // ļ + } + gdalImage inSigmaHHRaster(in_SigmaHHRasterPath); + gdalImage inIncidencAngleRaster(in_IncidencAngleRasterPath); + // 3. ӰСǷһ + if (inSigmaHHRaster.width != inIncidencAngleRaster.width || inSigmaHHRaster.height != inIncidencAngleRaster.height) + { + qDebug() << "Input images have different sizes."; + throw std::runtime_error("Input images have different sizes."); + return 3; // ӰСһ + } + + // ļļ + copyFile(in_SigmaHHRasterPath, out_SigmaVVRasterPath); + // 4. ļǷ + if (!QFile::exists(out_SigmaVVRasterPath)) + { + qDebug() << "Output file does not exist."; + throw std::runtime_error("Output file does not exist."); + return 4; // ļ + } + } + + // step 2 ִв + { + gdalImage inSigmaHHRaster(in_SigmaHHRasterPath); + gdalImage inIncidencAngleRaster(in_IncidencAngleRasterPath); + gdalImage outSigmaVVRaster(out_SigmaVVRasterPath); + + long width = inSigmaHHRaster.width; + long height = inSigmaHHRaster.height; + + int64_t pixel_count64 = static_cast(height) * static_cast(width); + // ȡӰ + std::shared_ptr sigmaHHRasterData = readDataArr(inSigmaHHRaster, 0, 0, height, width, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr incidenceAngleData = readDataArr(inIncidencAngleRaster, 0, 0, height, width, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + std::shared_ptr outSigmaVVRasterData = readDataArr(outSigmaVVRaster, 0, 0, height, width, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); + +#pragma omp parallel for + for (int64_t i = 0; i < pixel_count64; i++) + { + double sigmaHH = sigmaHHRasterData.get()[i]; + sigmaHH = converSigma2amp(sigmaHH,sigmatype); + double incidenceAngle = incidenceAngleData.get()[i];// Ƕ + sigmaHH = 20 * log10(sigmaHH); + double sigmaVV = polartionConver_d(sigmaHH, incidenceAngle, 1.0, false); // dBֵ + outSigmaVVRasterData.get()[i] = sigmaVV; + } + + // Ӱ + outSigmaVVRaster.saveImage(outSigmaVVRasterData,0,0,height,width,1); + // ͷڴ + sigmaHHRasterData.reset(); + incidenceAngleData.reset(); + outSigmaVVRasterData.reset(); + + } + return -1;// ִгɹ +} diff --git a/GF3CalibrationAndOrthLib/GF3CalibrationAndOrthLib.h b/GF3CalibrationAndOrthLib/GF3CalibrationAndOrthLib.h new file mode 100644 index 0000000..ff7787b --- /dev/null +++ b/GF3CalibrationAndOrthLib/GF3CalibrationAndOrthLib.h @@ -0,0 +1,34 @@ +#pragma once +/** +* GF3ӰļУ䴦ݿ +* @file GF3CalibrationAndOrthLib.h +* @brief GF3Ӱ񼸺У䴦ݿ +* @details +* GF3ӰļУ䴦ҪHH->VVתӰļУ䴦ȡ +* ʵֻGF3ӰļУ䴦㷨ʵϸοס +* @author +*/ +#ifndef __GF3CALIBRATIONANDORTHLIB__H__ +#define __GF3CALIBRATIONANDORTHLIB__H__ +#include "gf3calibrationandorthlib_global.h" +#include +#include "BaseConstVariable.h" + + +/// +/// HH״ɢϵתΪVV״ɢϵ +/// +/// +/// +/// +/// +/// +int GF3CALIBRATIONANDORTHLIB_EXPORT GF3_Sigma0_HH2VV(QString in_SigmaHHRasterPath, QString in_IncidencAngleRasterPath, QString out_SigmaVVRasterPath, SIGMATYPE sigmatype= SIGMATYPE::AMPVALUE); + + +#endif + + + + + diff --git a/GF3CalibrationAndOrthLib/GF3CalibrationAndOrthLib.vcxproj b/GF3CalibrationAndOrthLib/GF3CalibrationAndOrthLib.vcxproj new file mode 100644 index 0000000..f70cfbc --- /dev/null +++ b/GF3CalibrationAndOrthLib/GF3CalibrationAndOrthLib.vcxproj @@ -0,0 +1,154 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {886F7829-AF74-4F23-B3BE-29B7B3C9843C} + QtVS_v304 + 10.0 + 10.0 + $(MSBuildProjectDirectory)\QtMsBuild + + + + DynamicLibrary + v143 + true + Unicode + + + DynamicLibrary + v143 + false + true + Unicode + + + + + + + tools_qt5 + core + debug + + + tools_qt5 + core;xml;opengl;gui;xmlpatterns;widgets;quick;dbus;datavisualization + release + + + + + + + + + + + + + + + + + + + + + .;..\GPUBaseLib\GPUTool;..\GPUBaseLib;..\BaseCommonLibrary\ToolAbstract;..\BaseCommonLibrary\BaseTool;..\BaseCommonLibrary;$(IncludePath) + + + + true + + + + + compute_86,sm_86 + true + + + true + true + stdcpp14 + stdc11 + + + cufft.lib;cudart.lib;cudadevrt.lib;%(AdditionalDependencies) + + + + + true + GF3CALIBRATIONANDORTHLIB_LIB;%(PreprocessorDefinitions) + Level3 + true + true + + + Windows + true + + + + + true + GF3CALIBRATIONANDORTHLIB_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + Level3 + true + true + true + true + + + Windows + DebugFull + true + true + + + + + + + + + + + + + + + + + + + + + + {872ecd6f-30e3-4a1b-b17c-15e87d373ff6} + + + {b8b40c54-f7fe-4809-b6fb-8bc014570d7b} + + + + + + + + + + + + + \ No newline at end of file diff --git a/GF3CalibrationAndOrthLib/GF3CalibrationAndOrthLib.vcxproj.filters b/GF3CalibrationAndOrthLib/GF3CalibrationAndOrthLib.vcxproj.filters new file mode 100644 index 0000000..95b5125 --- /dev/null +++ b/GF3CalibrationAndOrthLib/GF3CalibrationAndOrthLib.vcxproj.filters @@ -0,0 +1,75 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {99349809-55BA-4b9d-BF79-8FDBB0286EB3} + ui + + + {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} + ts + + + + + Header Files + + + Source Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/GF3CalibrationAndOrthLib/GF3CalibrationGecodingBaseFuntion.h b/GF3CalibrationAndOrthLib/GF3CalibrationGecodingBaseFuntion.h new file mode 100644 index 0000000..07db6ac --- /dev/null +++ b/GF3CalibrationAndOrthLib/GF3CalibrationGecodingBaseFuntion.h @@ -0,0 +1,9 @@ +#pragma once +#ifndef __GF3CALIBRATIONGECODINGBASEFUNTION__H__ +#define __GF3CALIBRATIONGECODINGBASEFUNTION__H__ +#include "gf3calibrationandorthlib_global.h" +#include "BaseConstVariable.h" + + + +#endif // __GF3CALIBRATIONGECODINGBASEFUNTION__H__ \ No newline at end of file diff --git a/GF3CalibrationAndOrthLib/GF3CalibrationGeoCodingFunCUDA.cu b/GF3CalibrationAndOrthLib/GF3CalibrationGeoCodingFunCUDA.cu new file mode 100644 index 0000000..a40f82d --- /dev/null +++ b/GF3CalibrationAndOrthLib/GF3CalibrationGeoCodingFunCUDA.cu @@ -0,0 +1,104 @@ +#include "GF3CalibrationGeoCodingFunCUDA.cuh" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "BaseConstVariable.h" +#include "GPUTool.cuh" + + +__device__ __host__ float Computrer_polartionConver_rpol_f(float inangle, float alpha) +{ + float tang = 0.0; + if (inangle <= 0.0) { + tang = 0.0; + } + else if (inangle > 90.0) { + tang = 90.0; + } + else { + tang = inangle; + } + tang = tang * PI / 180.0; + float tan_val = tanf(tang); + float rpol = powf((1.0 + 2.0 * tan_val * tan_val), 2) / powf((1.0 + alpha * tan_val * tan_val), 2); + return rpol; +} + +__device__ __host__ double Computrer_polartionConver_rpol_d(double inangle, double alpha) +{ + double tang = 0.0; + if (inangle <= 0.0) { + tang = 0.0; + } + else if (inangle > 90.0) { + tang = 90.0; + } + else { + tang = inangle; + } + tang = tang * PI / 180.0; + double tan_val = tan(tang); + double rpol = pow((1.0 + 2.0 * tan_val * tan_val), 2) / pow((1.0 + alpha * tan_val * tan_val), 2); + return rpol; +} + +__host__ __device__ float polartionConver_f(float insig, float inangle, float alpha , bool isvv ) +{ + float rpol = Computrer_polartionConver_rpol_f(inangle, alpha); + + // dBת + float insig_linear = powf(10.0, insig / 10.0); + float osig = 0.0; + if (isvv) { // C: VV->HH + osig = insig_linear * rpol; + // ֵ + return osig; + } + else { // L: HH->VV + osig = insig_linear / rpol; + // dBֵ + return 10.0 * log10f(osig); + } +} + +void GPUComputePolarizationConver_f(float* insig, float* inangle, float* alpha, bool isvv, int count, float* outsig) +{ +} + +void GPUComputePolarizationConver_d(double* insig, double* inangle, double* alpha, bool isvv, int count, double* outsig) +{ +} + + +__host__ __device__ double polartionConver_d(double insig, double inangle, double alpha , bool isvv ) +{ + double rpol = Computrer_polartionConver_rpol_d(inangle, alpha); + + // dBת + double insig_linear = pow(10.0, insig / 10.0); + double osig = 0.0; + if (isvv) { // C: VV->HH + osig = insig_linear * rpol; + // dBֵ + return 10.0 * log10(osig); + } else { // L: HH->VV + osig = insig_linear / rpol; + // dBֵ + return 10.0 * log10(osig); + } +} + +/** ˺ ******************************************************************************************************************************/ + + + + +/** ú ******************************************************************************************************************************/ + diff --git a/GF3CalibrationAndOrthLib/GF3CalibrationGeoCodingFunCUDA.cuh b/GF3CalibrationAndOrthLib/GF3CalibrationGeoCodingFunCUDA.cuh new file mode 100644 index 0000000..b4e6fab --- /dev/null +++ b/GF3CalibrationAndOrthLib/GF3CalibrationGeoCodingFunCUDA.cuh @@ -0,0 +1,72 @@ +#ifndef __GF3CALIBRATIONGEOCODINGFUNCUDA__H__ +#define __GF3CALIBRATIONGEOCODINGFUNCUDA__H__ +#include "gf3calibrationandorthlib_global.h" + + +#include "BaseConstVariable.h" +#include "GPUTool.cuh" +#include +#include +#include +#include + +/** ˺ *********************************************************************************************************************/ +/// +/// 㼫תϵfloat +/// +/// +/// ת +/// +extern __device__ __host__ float Computrer_polartionConver_rpol_f(float inangle, float alpha = 1); + +/// +/// 㼫תϵ (double) +/// +/// +/// ת +/// +extern __device__ __host__ double Computrer_polartionConver_rpol_d(double inangle, double alpha = 1); + +/// +/// ɢϵ任 +/// +/// sigma0 (dB) +/// () +/// Ĭ1ģͣ0.6Ϊķɭ +/// trueʾΪVVfalseΪHH +/// +extern __host__ __device__ double polartionConver_d(double insig, double inangle, double alpha = 1.0, bool isvv = true); + +/// +/// ɢϵ任 +/// +/// sigma0 (dB) +/// () +/// Ĭ1ģͣ0.6Ϊķɭ +/// trueʾΪVVfalseΪHH +/// +extern __host__ __device__ float polartionConver_f(float insig, float inangle, float alpha = 1.0, bool isvv = true); + + + + + + +/** ú ******************************************************************************************************************************/ + +extern "C" void GPUComputePolarizationConver_f( + float* insig, float* inangle, float* alpha, + bool isvv, int count, + float* outsig +); +extern "C" void GPUComputePolarizationConver_d( + double* insig, double* inangle, double* alpha, + bool isvv, int count, + double* outsig +); + + + + +#endif + diff --git a/Toolbox/BaseToolbox/BaseToolbox/GF3PSTNClass.cpp b/GF3CalibrationAndOrthLib/GF3PSTNClass.cpp similarity index 100% rename from Toolbox/BaseToolbox/BaseToolbox/GF3PSTNClass.cpp rename to GF3CalibrationAndOrthLib/GF3PSTNClass.cpp diff --git a/Toolbox/BaseToolbox/BaseToolbox/GF3PSTNClass.h b/GF3CalibrationAndOrthLib/GF3PSTNClass.h similarity index 87% rename from Toolbox/BaseToolbox/BaseToolbox/GF3PSTNClass.h rename to GF3CalibrationAndOrthLib/GF3PSTNClass.h index babc6bd..fddc8d1 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/GF3PSTNClass.h +++ b/GF3CalibrationAndOrthLib/GF3PSTNClass.h @@ -1,8 +1,9 @@ #pragma once +#ifndef __GF3PSTNCLASS_H__ +#define __GF3PSTNCLASS_H__ - - +#include "gf3calibrationandorthlib_global.h" #include "LogInfoCls.h" #include "BaseConstVariable.h" @@ -14,7 +15,7 @@ /// /// ʽģ /// -class GF3PolyfitSatelliteOribtModel +class GF3CALIBRATIONANDORTHLIB_EXPORT GF3PolyfitSatelliteOribtModel { public: GF3PolyfitSatelliteOribtModel(); @@ -43,8 +44,9 @@ public: // virtual void setAntnnaAxisY(double X, double Y, double Z) ; // Xָ virtual void setAntnnaAxisZ(double X, double Y, double Z) ; // Xָ - virtual ErrorCode getAntnnaDirection(SatelliteOribtNode& node) ; // ȡָ - virtual ErrorCode getZeroDopplerAntDirect(SatelliteOribtNode& node) ; + virtual ErrorCode getAntnnaDirection(SatelliteOribtNode& node); // ȡָ + virtual ErrorCode getZeroDopplerAntDirect(SatelliteOribtNode& node); + private: // long double oribtStartTime; // ģͲοʱ double beamAngle; // λ @@ -93,16 +95,14 @@ public: //virtual void setPt(double Pt); //virtual void setGri(double gri); - - private: double Pt; // ѹ double Gri;// ϵͳ }; -std::shared_ptr CreataGF3PolyfitSatelliteOribtModel(std::vector& nodes, long double startTime, int polynum = 3); - +std::shared_ptr GF3CALIBRATIONANDORTHLIB_EXPORT CreataGF3PolyfitSatelliteOribtModel(std::vector& nodes, long double startTime, int polynum = 3); +#endif diff --git a/GF3CalibrationAndOrthLib/GF3Util.cpp b/GF3CalibrationAndOrthLib/GF3Util.cpp new file mode 100644 index 0000000..e95d30d --- /dev/null +++ b/GF3CalibrationAndOrthLib/GF3Util.cpp @@ -0,0 +1,84 @@ +#include "GF3Util.h" +#include +#include + +GF3TargzFilenameClass getFilename(QString filename) +{ + return GF3TargzFilenameClass(filename); + +} + +GF3TargzFilenameClass::GF3TargzFilenameClass(QString filename) +{ + // GF3_KAS_FSI_020253_E110.8_N25.5_20200614_L1A_HHHV_L10004871459.tar.gz + QStringList filelist = filename.split("_"); + + this->sateName = filelist[0]; + this->RevStateName = filelist[1]; + this->ImageMode = filelist[2]; + this->OribtName = filelist[3]; + this->CenterLon = filelist[4].left(1).toDouble(); + this->CenterLat = filelist[5].left(1).toDouble(); + this->DateName = filelist[6]; + this->levelName = filelist[7]; + this->PolarName = filelist[8]; + this->ProductName = filelist[9]; + if (this->ProductName.contains(".")) { + this->ProductName = this->ProductName.split(".")[0]; + }else{} +} + +GF3TargzFilenameClass::~GF3TargzFilenameClass() +{ + +} + +QString GF3TargzFilenameClass::getSateName() const +{ + return sateName; +} + +QString GF3TargzFilenameClass::getRevStateName() const +{ + return RevStateName; +} + +QString GF3TargzFilenameClass::getImageMode() const +{ + return ImageMode; +} + +QString GF3TargzFilenameClass::getOribtName() const +{ + return OribtName; +} + +double GF3TargzFilenameClass::getCenterLon() const +{ + return CenterLon; +} + +double GF3TargzFilenameClass::getCenterLat() const +{ + return CenterLat; +} + +QString GF3TargzFilenameClass::getDateName() const +{ + return DateName; +} + +QString GF3TargzFilenameClass::getLevelName() const +{ + return levelName; +} + +QString GF3TargzFilenameClass::getPolarName() const +{ + return PolarName; +} + +QString GF3TargzFilenameClass::getProductName() const +{ + return ProductName; +} diff --git a/GF3CalibrationAndOrthLib/GF3Util.h b/GF3CalibrationAndOrthLib/GF3Util.h new file mode 100644 index 0000000..5d0aef1 --- /dev/null +++ b/GF3CalibrationAndOrthLib/GF3Util.h @@ -0,0 +1,47 @@ +#pragma once +#ifndef __GF3UTIL_H__ +#define __GF3UTIL_H__ +#include "gf3calibrationandorthlib_global.h" +#include + +class GF3CALIBRATIONANDORTHLIB_EXPORT GF3TargzFilenameClass { + // GF3_KAS_FSI_020253_E110.8_N25.5_20200614_L1A_HHHV_L10004871459.tar.gz + +public: + GF3TargzFilenameClass(QString filename); + ~GF3TargzFilenameClass(); + +private: + QString sateName; + QString RevStateName; + QString ImageMode; + QString OribtName; + double CenterLon; + double CenterLat; + QString DateName; + QString levelName; + QString PolarName; + QString ProductName; + +public: + QString getSateName() const; //{ return sateName; } + QString getRevStateName() const;// { return RevStateName; } + QString getImageMode() const; //{ return ImageMode; } + QString getOribtName() const; //{ return OribtName; } + double getCenterLon() const; //{ return CenterLon; } + double getCenterLat() const; //{ return CenterLat; } + QString getDateName() const; //{ return DateName; } + QString getLevelName() const; //{ return levelName; } + QString getPolarName() const;// { return PolarName; } + QString getProductName() const; //{ return ProductName; } + +}; + + + +GF3TargzFilenameClass GF3CALIBRATIONANDORTHLIB_EXPORT getFilename(QString filename); + + + + +#endif \ No newline at end of file diff --git a/Toolbox/BaseToolbox/BaseToolbox/SateOrbit.cpp b/GF3CalibrationAndOrthLib/SateOrbit.cpp similarity index 86% rename from Toolbox/BaseToolbox/BaseToolbox/SateOrbit.cpp rename to GF3CalibrationAndOrthLib/SateOrbit.cpp index ac036bd..1aa04f7 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/SateOrbit.cpp +++ b/GF3CalibrationAndOrthLib/SateOrbit.cpp @@ -41,27 +41,19 @@ Eigen::MatrixX OrbitPoly::SatelliteSpacePoint(long double satellitetime) if (this->polySatellitePara.rows() != polynum || this->polySatellitePara.cols() != 6) { throw exception("the size of satellitetime has error!! row: p1,p2,p3,p4 col: x,y,z,vx,vy,vz "); } - // ????????? + double satellitetime2 =double( satellitetime - this->SatelliteModelStartTime); Eigen::MatrixX satetime(1, polynum); for (int i = 0; i < polynum; i++) { satetime(0, i) = pow(satellitetime2, i); } - // ???? Eigen::MatrixX satellitePoints(1, 6); satellitePoints = satetime * polySatellitePara; return satellitePoints; } -/// -/// ???????????????????? -/// -/// ??????? -/// ?????????? -/// ??????[x1,y1,z1,vx1,vy1,vz1; x2,y2,z2,vx2,vy2,vz2; ..... ] -/// ?????????? -/// ???????? + Eigen::MatrixX SatelliteSpacePoints(Eigen::MatrixX& satellitetime, double SatelliteModelStartTime, Eigen::MatrixX& polySatellitePara, int polynum) { if (satellitetime.cols() != 1) { @@ -70,7 +62,7 @@ Eigen::MatrixX SatelliteSpacePoints(Eigen::MatrixX& satellitetim if (polySatellitePara.rows() != polynum || polySatellitePara.cols() != 6) { throw exception("the size of satellitetime has error!! row: p1,p2,p3,p4 col: x,y,z,vx,vy,vz "); } - // ????????? + int satellitetime_num = satellitetime.rows(); satellitetime = satellitetime.array() - SatelliteModelStartTime; Eigen::MatrixX satelliteTime(satellitetime_num, polynum); @@ -78,7 +70,6 @@ Eigen::MatrixX SatelliteSpacePoints(Eigen::MatrixX& satellitetim satelliteTime.col(i) = satellitetime.array().pow(i); } - // ???? Eigen::MatrixX satellitePoints(satellitetime_num, 6); satellitePoints = satelliteTime * polySatellitePara; return satellitePoints; diff --git a/Toolbox/BaseToolbox/BaseToolbox/SateOrbit.h b/GF3CalibrationAndOrthLib/SateOrbit.h similarity index 73% rename from Toolbox/BaseToolbox/BaseToolbox/SateOrbit.h rename to GF3CalibrationAndOrthLib/SateOrbit.h index 5148739..4b65871 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/SateOrbit.h +++ b/GF3CalibrationAndOrthLib/SateOrbit.h @@ -1,4 +1,6 @@ #pragma once +#ifndef __SATEORIBT_H__ +#define __SATEORIBT_H__ /// /// ǹ /// @@ -7,6 +9,7 @@ //#define EIGEN_VECTORIZE_SSE4_2 //#include // ط +#include "gf3calibrationandorthlib_global.h" #include "BaseTool.h" #include #include @@ -16,15 +19,15 @@ //#include -using namespace std; -using namespace Eigen; +//using namespace std; +//using namespace Eigen; //using namespace arma; /// /// ʽģ /// -class OrbitPoly { +class GF3CALIBRATIONANDORTHLIB_EXPORT OrbitPoly { public: //OrbitPoly(std::string orbitModelPath); OrbitPoly(); @@ -49,4 +52,8 @@ public: /// ģͲ[x1,y1,z1,vx1,vy1,vz1; x2,y2,z2,vx2,vy2,vz2; ..... ] /// ģͲ /// -Eigen::MatrixX SatelliteSpacePoints(Eigen::MatrixX &satellitetime, double SatelliteModelStartTime, Eigen::MatrixX& polySatellitePara, int polynum = 4); +Eigen::MatrixX GF3CALIBRATIONANDORTHLIB_EXPORT SatelliteSpacePoints(Eigen::MatrixX &satellitetime, double SatelliteModelStartTime, Eigen::MatrixX& polySatellitePara, int polynum = 4); + + + +#endif \ No newline at end of file diff --git a/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.cpp b/GF3CalibrationAndOrthLib/SatelliteGF3xmlParser.cpp similarity index 100% rename from Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.cpp rename to GF3CalibrationAndOrthLib/SatelliteGF3xmlParser.cpp diff --git a/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.h b/GF3CalibrationAndOrthLib/SatelliteGF3xmlParser.h similarity index 89% rename from Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.h rename to GF3CalibrationAndOrthLib/SatelliteGF3xmlParser.h index 8bbf282..91a1f89 100644 --- a/Toolbox/BaseToolbox/BaseToolbox/SatelliteGF3xmlParser.h +++ b/GF3CalibrationAndOrthLib/SatelliteGF3xmlParser.h @@ -1,4 +1,8 @@ #pragma once +#ifndef __SATELLITEGF3XMLPARSER_H__ +#define __SATELLITEGF3XMLPARSER_H__ + +#include "gf3calibrationandorthlib_global.h" #include #include #include @@ -9,7 +13,7 @@ -class SatelliteGF3xmlParser { +class GF3CALIBRATIONANDORTHLIB_EXPORT SatelliteGF3xmlParser { public: bool loadFile(const QString& filename); @@ -51,3 +55,5 @@ public: + +#endif \ No newline at end of file diff --git a/GF3CalibrationAndOrthLib/gf3calibrationandorthlib_global.h b/GF3CalibrationAndOrthLib/gf3calibrationandorthlib_global.h new file mode 100644 index 0000000..a423e18 --- /dev/null +++ b/GF3CalibrationAndOrthLib/gf3calibrationandorthlib_global.h @@ -0,0 +1,13 @@ +#pragma once +#ifndef __GF3CALIBRATIONANDORTHLIB_GLOBAL_H__ +#define __GF3CALIBRATIONANDORTHLIB_GLOBAL_H__ + + +#ifdef GF3CALIBRATIONANDORTHLIB_LIB +#define GF3CALIBRATIONANDORTHLIB_EXPORT __declspec(dllexport) +#else +#define GF3CALIBRATIONANDORTHLIB_EXPORT __declspec(dllimport) +#endif + + +#endif// __GF3CALIBRATIONANDORTHLIB_GLOBAL_H__ \ No newline at end of file diff --git a/GF3StripPatchProcess/GF3StripPatchProcess.vcxproj b/GF3StripPatchProcess/GF3StripPatchProcess.vcxproj new file mode 100644 index 0000000..298380e --- /dev/null +++ b/GF3StripPatchProcess/GF3StripPatchProcess.vcxproj @@ -0,0 +1,134 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {6386D3E3-B743-419F-8354-DA48D0B08728} + QtVS_v304 + 10.0 + 10.0 + $(MSBuildProjectDirectory)\QtMsBuild + + + + Application + v143 + true + Unicode + + + Application + v143 + false + true + Unicode + + + + + + + tools_qt5 + core;gui;widgets + debug + + + tools_qt5 + core;xml;sql;opengl;gui;widgets;location;dbus;charts;datavisualization + release + + + + + + + + + + + + + + + + + + + true + true + true + true + ..\GF3CalibrationAndOrthLib;..\GPUBaseLib;..\BaseCommonLibrary\ToolAbstract;..\BaseCommonLibrary\BaseTool;..\BaseCommonLibrary;.;$(IncludePath) + + + + %(AdditionalDependencies) + + + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + + + true + Level3 + true + true + + + Console + true + + + + + true + Level3 + true + true + true + true + + + Console + DebugFull + true + true + + + + + + + + + + + + + + + {872ecd6f-30e3-4a1b-b17c-15e87d373ff6} + + + {886f7829-af74-4f23-b3be-29b7b3c9843c} + + + {b8b40c54-f7fe-4809-b6fb-8bc014570d7b} + + + + + + + + + \ No newline at end of file diff --git a/GF3StripPatchProcess/GF3StripPatchProcess.vcxproj.filters b/GF3StripPatchProcess/GF3StripPatchProcess.vcxproj.filters new file mode 100644 index 0000000..341be1e --- /dev/null +++ b/GF3StripPatchProcess/GF3StripPatchProcess.vcxproj.filters @@ -0,0 +1,46 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {99349809-55BA-4b9d-BF79-8FDBB0286EB3} + ui + + + {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} + ts + + + {da979fa3-1a37-4b67-aaf3-148de4a4c027} + + + + + Source Files + + + Source Files + + + + + Header Files + + + + + Form Files + + + \ No newline at end of file diff --git a/GF3StripPatchProcess/QGF3StripBatchProcessDialog.cpp b/GF3StripPatchProcess/QGF3StripBatchProcessDialog.cpp new file mode 100644 index 0000000..a2322dc --- /dev/null +++ b/GF3StripPatchProcess/QGF3StripBatchProcessDialog.cpp @@ -0,0 +1,149 @@ +#include "QGF3StripBatchProcessDialog.h" +#include "ui_QGF3StripBatchProcessDialog.h" +#include +#include +#include +#include "FileOperator.h" +#include "GeoOperator.h" +#include "BaseTool.h" +#include "GF3CalibrationAndGeocodingClass.h" + +QGF3StripBatchProcessDialog::QGF3StripBatchProcessDialog(QWidget *parent) + : QDialog(parent), ui(new Ui::QGF3StripBatchProcessDialogClass) +{ + ui->setupUi(this); + + QObject::connect(ui->pushButtonAdd, SIGNAL(clicked(bool)), this, SLOT(onpushButtonAddClicked(bool))); + QObject::connect(ui->pushButtonRemove, SIGNAL(clicked(bool)), this, SLOT(onpushButtonRemoveClicked(bool))); + QObject::connect(ui->pushButtonWorkSpace, SIGNAL(clicked(bool)), this, SLOT(onpushButtonWorkSpaceClicked(bool))); + QObject::connect(ui->checkBoxDEM, SIGNAL(stateChanged(int)), this, SLOT(ontstateChanged(int))); + QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onreject())); + QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onaccept())); + QObject::connect(ui->pushButton_lineDEM, SIGNAL(clicked(bool)), this, SLOT(onpushButtonDEM(bool))); + + + +} + +QGF3StripBatchProcessDialog::~QGF3StripBatchProcessDialog() +{} + +void QGF3StripBatchProcessDialog::onaccept() +{ + QString demPath = ""; + // ȡĬDEM + if (ui->checkBoxDEM->isChecked()) { + QString demdirPath = QApplication::applicationDirPath();// DEMļ + demPath = JoinPath(demdirPath,"SRTM_90m_DEM_V4.tif"); + } + else { + demPath = ui->lineEdit_DEM->text(); + } + // ȡֱ + double resolutionMeter = ui->doubleSpinBox->value();// ֱת + //double resoiutionDegree = getPixelSpacingInDegree(resolutionMeter);// -> + QString workspacedirpath = ui->lineEditWorkDir->text(); + this->ui->progressBar->setValue(0); + this->ui->progressBar->setMaximum(ui->listWidgetMetaxml->count()); + bool polarHH2VV = ui->checkoutPolarHH2VV->isChecked(); + for (long i = 0; i < ui->listWidgetMetaxml->count(); i++) { + QString inTargzFilePath = ui->listWidgetMetaxml->item(i)->text(); + this->ui->label_info->setText(QString(u8"䴦%1").arg(inTargzFilePath)); + GF3MainOrthProcess(demPath, + inTargzFilePath, + workspacedirpath, + resolutionMeter, + polarHH2VV); + + this->ui->progressBar->setValue(i); + } + QMessageBox::information(this, u8"䴦", u8"䴦"); +} + +void QGF3StripBatchProcessDialog::onreject() +{ + this->close(); +} + +void QGF3StripBatchProcessDialog::onpushButtonAddClicked(bool) +{ + QStringList fileNames = QFileDialog::getOpenFileNames( + this, // + tr(u8"ѡGF3L1Aѹ"), // + QString(), // Ĭ· + tr(u8"tar.gz (*.tar.gz);;tar (*.tar);;All Files (*)") // ļ + ); + + // ûѡļ + if (!fileNames.isEmpty()) { + QString message = "ѡļУ\n"; + for (const QString& fileName : fileNames) { + this->ui->listWidgetMetaxml->addItem(fileName); + } + } + else { + QMessageBox::information(this, tr(u8"ûѡļ"), tr(u8"ûѡκļ")); + } +} + +void QGF3StripBatchProcessDialog::onpushButtonRemoveClicked(bool) +{ + QList selectedItems = this->ui->listWidgetMetaxml->selectedItems(); + for (QListWidgetItem* item : selectedItems) { + delete this->ui->listWidgetMetaxml->takeItem(this->ui->listWidgetMetaxml->row(item)); + } +} + +void QGF3StripBatchProcessDialog::onpushButtonWorkSpaceClicked(bool) +{ + // ļѡԻѡһ .tif ļ + QString fileName = QFileDialog::getExistingDirectory(this, u8"ѡռ·", ""); + + if (!fileName.isEmpty()) { + ui->lineEditWorkDir->setText(fileName); + } + else { + QMessageBox::information(this, u8"ûѡļ", u8"ûѡκļ"); + } +} + +void QGF3StripBatchProcessDialog::ontstateChanged(int checked) +{ + bool checkedflag = ui->checkBoxDEM->isChecked(); + if (!checkedflag) { + ui->pushButton_lineDEM->setEnabled(true); + ui->lineEdit_DEM->setEnabled(true); + } + else { + ui->pushButton_lineDEM->setEnabled(false); + ui->lineEdit_DEM->setEnabled(false); + } +} + +void QGF3StripBatchProcessDialog::onpushButtonDEM(bool flag) +{ + QString fileName = QFileDialog::getOpenFileName(this, u8"ѡDEMļ", "", u8"tif (*.tif);;All Files (*)"); + if (!fileName.isEmpty()) { + ui->lineEdit_DEM->setText(fileName); + } + else { + QMessageBox::information(this, u8"ûѡļ", u8"ûѡκļ"); + } +} + +void showQGF3StripBatchProcessDialog(QWidget* parent) +{ + QGF3StripBatchProcessDialog* dialog = new QGF3StripBatchProcessDialog(parent); + dialog->setWindowTitle(u8"GF3Ӱ"); + dialog->setAttribute(Qt::WA_DeleteOnClose); + dialog->show(); +} + +QString getDefaultDEMFilePath() +{ + QString fileName = QFileDialog::getOpenFileName(nullptr, u8"ѡDEMļ", "", u8"tif (*.tif);;All Files (*)"); + return QString(); +} + + + diff --git a/GF3StripPatchProcess/QGF3StripBatchProcessDialog.h b/GF3StripPatchProcess/QGF3StripBatchProcessDialog.h new file mode 100644 index 0000000..a87a156 --- /dev/null +++ b/GF3StripPatchProcess/QGF3StripBatchProcessDialog.h @@ -0,0 +1,40 @@ +#pragma once +#ifndef __QGF3STRIPBATCHPROCESSDIALOG_H__ +#define __QGF3STRIPBATCHPROCESSDIALOG_H__ + +#include + +namespace Ui{ + class QGF3StripBatchProcessDialogClass; +} + +class QGF3StripBatchProcessDialog : public QDialog +{ + Q_OBJECT + +public: + QGF3StripBatchProcessDialog(QWidget *parent = nullptr); + ~QGF3StripBatchProcessDialog(); + +public slots: + void onaccept(); + void onreject(); + void onpushButtonAddClicked(bool); + void onpushButtonRemoveClicked(bool); + void onpushButtonWorkSpaceClicked(bool); + + void ontstateChanged(int checked); + void onpushButtonDEM(bool flag); + +private: + Ui::QGF3StripBatchProcessDialogClass* ui; +}; + + +// ģʾ +void showQGF3StripBatchProcessDialog(QWidget* parent = nullptr); +QString getDefaultDEMFilePath(); + + + +#endif diff --git a/GF3StripPatchProcess/QGF3StripBatchProcessDialog.ui b/GF3StripPatchProcess/QGF3StripBatchProcessDialog.ui new file mode 100644 index 0000000..cae394c --- /dev/null +++ b/GF3StripPatchProcess/QGF3StripBatchProcessDialog.ui @@ -0,0 +1,263 @@ + + + QGF3StripBatchProcessDialogClass + + + + 0 + 0 + 787 + 580 + + + + QGF3StripBatchProcessDialog + + + + + + + + + 12 + + + + GF3条带列表(L1A) + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QAbstractItemView::MultiSelection + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + 0 + 30 + + + + 删除 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + 参数 + + + + + + + 0 + 30 + + + + 选择 + + + + + + + 分辨率(m) + + + + + + + 默认DEM + + + + + + + + 0 + 30 + + + + + + + + DEM文件地址: + + + + + + + + 0 + 30 + + + + 100000.000000000000000 + + + + + + + 极化转换:HH->VV + + + + + + + + + + + + + 0 + 30 + + + + 输出工作空间: + + + + + + + + 0 + 30 + + + + + + + + + 0 + 30 + + + + 选择 + + + + + + + + + + + + + + TextLabel + + + + + + + + + 24 + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + diff --git a/GF3StripPatchProcess/QSS/AMOLED.qss b/GF3StripPatchProcess/QSS/AMOLED.qss new file mode 100644 index 0000000..0083acb --- /dev/null +++ b/GF3StripPatchProcess/QSS/AMOLED.qss @@ -0,0 +1,576 @@ +/* +AMOLED Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 01/10/2021, 15:49. +Available at: https://github.com/GTRONICK/QSS/blob/master/AMOLED.qss +*/ +QMainWindow { + background-color:#000000; +} +QDialog { + background-color:#000000; +} +QColorDialog { + background-color:#000000; +} +QTextEdit { + background-color:#000000; + color: #a9b7c6; +} +QPlainTextEdit { + selection-background-color:#f39c12; + background-color:#000000; + border: 1px solid #FF00FF; + color: #a9b7c6; +} +QPushButton{ + border: 1px transparent; + color: #a9b7c6; + padding: 2px; + background-color: #000000; +} +QPushButton::default{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-width: 1px; + color: #a9b7c6; + padding: 2px; + background-color: #000000; +} +QPushButton:hover{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #FF00FF; + border-bottom-width: 1px; + border-bottom-radius: 6px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 2px; + background-color: #000000; +} +QPushButton:pressed{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #FF00FF; + border-bottom-width: 2px; + border-bottom-radius: 6px; + border-style: solid; + color: #e67e22; + padding-bottom: 1px; + background-color: #000000; +} +QPushButton:disabled{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 2px; + border-bottom-radius: 6px; + border-style: solid; + color: #808086; + padding-bottom: 1px; + background-color: #000000; +} +QToolButton { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-bottom-width: 1px; + border-style: solid; + color: #a9b7c6; + padding: 2px; + background-color: #000000; +} +QToolButton:hover{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-bottom-width: 2px; + border-bottom-radius: 6px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 1px; + background-color: #000000; +} +QLineEdit { + border-width: 1px; border-radius: 4px; + border-color: rgb(58, 58, 58); + border-style: inset; + padding: 0 8px; + color: #a9b7c6; + background:#000000; + selection-background-color:#007b50; + selection-color: #FFFFFF; +} +QLabel { + color: #a9b7c6; +} +QLCDNumber { + color: #e67e22; +} +QProgressBar { + text-align: center; + color: rgb(240, 240, 240); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; + background-color:#000000; +} +QProgressBar::chunk { + background-color: #e67e22; + border-radius: 5px; +} +QMenu{ + background-color:#000000; +} +QMenuBar { + background:rgb(0, 0, 0); + color: #a9b7c6; +} +QMenuBar::item { + spacing: 3px; + padding: 1px 4px; + background: transparent; +} +QMenuBar::item:selected { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-bottom-width: 1px; + border-bottom-radius: 6px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 0px; + background-color: #000000; +} +QMenu::item:selected { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: #e67e22; + border-bottom-color: transparent; + border-left-width: 2px; + color: #FFFFFF; + padding-left:15px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; + background-color:#000000; +} +QMenu::item { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + border-style: solid; + color: #a9b7c6; + padding-left:17px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; + background-color:#000000; +} +QTabWidget { + color:rgb(0,0,0); + background-color:#000000; +} +QTabWidget::pane { + border-color: rgb(77,77,77); + background-color:#000000; + border-style: solid; + border-width: 1px; + border-radius: 6px; +} +QTabBar::tab { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + border-style: solid; + color: #808086; + padding: 3px; + margin-left:3px; + background-color:#000000; +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-bottom-width: 2px; + border-style: solid; + color: #FFFFFF; + padding-left: 3px; + padding-bottom: 2px; + margin-left:3px; + background-color:#000000; +} + +QCheckBox { + color: #a9b7c6; + padding: 2px; +} +QCheckBox:disabled { + color: #808086; + padding: 2px; +} + +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: rgb(87, 97, 106); + background-color:#000000; +} +QCheckBox::indicator:checked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #e67e22; + color: #a9b7c6; + background-color: #e67e22; +} +QCheckBox::indicator:unchecked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #e67e22; + color: #a9b7c6; + background-color: transparent; +} +QRadioButton { + color: #a9b7c6; + background-color:#000000; + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #e67e22; + color: #a9b7c6; + background-color: #e67e22; +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #e67e22; + color: #a9b7c6; + background-color: transparent; +} +QStatusBar { + color:#34e8eb; +} +QSpinBox { + color: #a9b7c6; + background-color:#000000; +} +QDoubleSpinBox { + color: #a9b7c6; + background-color:#000000; +} +QTimeEdit { + color: #a9b7c6; + background-color:#000000; +} +QDateTimeEdit { + color: #a9b7c6; + background-color:#000000; +} +QDateEdit { + color: #a9b7c6; + background-color:#000000; +} +QComboBox { + color: #a9b7c6; + background: #1e1d23; +} +QComboBox:editable { + background: #1e1d23; + color: #a9b7c6; + selection-background-color:#000000; +} +QComboBox QAbstractItemView { + color: #a9b7c6; + background: #1e1d23; + selection-color: #FFFFFF; + selection-background-color:#000000; +} +QComboBox:!editable:on, QComboBox::drop-down:editable:on { + color: #a9b7c6; + background: #1e1d23; +} +QFontComboBox { + color: #a9b7c6; + background-color:#000000; +} +QToolBox { + color: #a9b7c6; + background-color:#000000; +} +QToolBox::tab { + color: #a9b7c6; + background-color:#000000; +} +QToolBox::tab:selected { + color: #FFFFFF; + background-color:#000000; +} +QScrollArea { + color: #FFFFFF; + background-color:#000000; +} +QSlider::groove:horizontal { + height: 5px; + background: #e67e22; +} +QSlider::groove:vertical { + width: 5px; + background: #e67e22; +} +QSlider::handle:horizontal { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f); + border: 1px solid #5c5c5c; + width: 14px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: qlineargradient(x1:1, y1:1, x2:0, y2:0, stop:0 #b4b4b4, stop:1 #8f8f8f); + border: 1px solid #5c5c5c; + height: 14px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal { + background: white; +} +QSlider::add-page:vertical { + background: white; +} +QSlider::sub-page:horizontal { + background: #e67e22; +} +QSlider::sub-page:vertical { + background: #e67e22; +} +QScrollBar:horizontal { + max-height: 20px; + background: rgb(0,0,0); + border: 1px transparent grey; + margin: 0px 20px 0px 20px; +} +QScrollBar::handle:horizontal { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + border-style: solid; + border-width: 1px; + border-color: rgb(0,0,0); + min-width: 25px; +} +QScrollBar::handle:horizontal:hover { + background: rgb(230, 126, 34); + border-style: solid; + border-width: 1px; + border-color: rgb(0,0,0); + min-width: 25px; +} +QScrollBar::add-line:horizontal { + border: 1px solid; + border-color: rgb(0,0,0); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:hover { + border: 1px solid; + border-color: rgb(0,0,0); + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:pressed { + border: 1px solid; + border-color: grey; + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal { + border: 1px solid; + border-color: rgb(0,0,0); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:hover { + border: 1px solid; + border-color: rgb(0,0,0); + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:pressed { + border: 1px solid; + border-color: grey; + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::left-arrow:horizontal { + border: 1px transparent grey; + border-radius: 3px; + width: 6px; + height: 6px; + background: rgb(0,0,0); +} +QScrollBar::right-arrow:horizontal { + border: 1px transparent grey; + border-radius: 3px; + width: 6px; + height: 6px; + background: rgb(0,0,0); +} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} +QScrollBar:vertical { + max-width: 20px; + background: rgb(0,0,0); + border: 1px transparent grey; + margin: 20px 0px 20px 0px; +} +QScrollBar::add-line:vertical { + border: 1px solid; + border-color: rgb(0,0,0); + background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:hover { + border: 1px solid; + border-color: rgb(0,0,0); + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:pressed { + border: 1px solid; + border-color: grey; + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical { + border: 1px solid; + border-color: rgb(0,0,0); + background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:hover { + border: 1px solid; + border-color: rgb(0,0,0); + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:pressed { + border: 1px solid; + border-color: grey; + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: top; + subcontrol-origin: margin; +} + QScrollBar::handle:vertical { + background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + border-style: solid; + border-width: 1px; + border-color: rgb(0,0,0); + min-height: 25px; +} +QScrollBar::handle:vertical:hover { + background: rgb(230, 126, 34); + border-style: solid; + border-width: 1px; + border-color: rgb(0,0,0); + min-heigth: 25px; +} +QScrollBar::up-arrow:vertical { + border: 1px transparent grey; + border-radius: 3px; + width: 6px; + height: 6px; + background: rgb(0,0,0); +} +QScrollBar::down-arrow:vertical { + border: 1px transparent grey; + border-radius: 3px; + width: 6px; + height: 6px; + background: rgb(0,0,0); +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} diff --git a/GF3StripPatchProcess/QSS/Aqua.qss b/GF3StripPatchProcess/QSS/Aqua.qss new file mode 100644 index 0000000..cce4c77 --- /dev/null +++ b/GF3StripPatchProcess/QSS/Aqua.qss @@ -0,0 +1,559 @@ +/* +Aqua Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 22/01/2019, 07:55. +Available at: https://github.com/GTRONICK/QSS/blob/master/Aqua.qss +*/ +QMainWindow { + background-color:#ececec; +} +QTextEdit { + border-width: 1px; + border-style: solid; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QPlainTextEdit { + border-width: 1px; + border-style: solid; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QToolButton { + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QToolButton:hover{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(197, 197, 197), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(197, 197, 197)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QToolButton:pressed{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(142,142,142); +} +QPushButton{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QPushButton::default{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QPushButton:hover{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(197, 197, 197), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(197, 197, 197)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QPushButton:pressed{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(142,142,142); +} +QPushButton:disabled{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: #808086; + padding: 2px; + background-color: rgb(142,142,142); +} +QLineEdit { + border-width: 1px; border-radius: 4px; + border-style: solid; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QLabel { + color: #000000; +} +QLCDNumber { + color: rgb(0, 113, 255, 255); +} +QProgressBar { + text-align: center; + color: rgb(240, 240, 240); + border-width: 1px; + border-radius: 10px; + border-color: rgb(230, 230, 230); + border-style: solid; + background-color:rgb(207,207,207); +} +QProgressBar::chunk { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); + border-radius: 10px; +} +QMenuBar { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(207, 209, 207, 255), stop:1 rgba(230, 229, 230, 255)); +} +QMenuBar::item { + color: #000000; + spacing: 3px; + padding: 1px 4px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(207, 209, 207, 255), stop:1 rgba(230, 229, 230, 255)); +} + +QMenuBar::item:selected { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #FFFFFF; +} +QMenu::item:selected { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + border-bottom-color: transparent; + border-left-width: 2px; + color: #000000; + padding-left:15px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; +} +QMenu::item { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + color: #000000; + padding-left:17px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; +} +QTabWidget { + color:rgb(0,0,0); + background-color:#000000; +} +QTabWidget::pane { + border-color: rgb(223,223,223); + background-color:rgb(226,226,226); + border-style: solid; + border-width: 2px; + border-radius: 6px; +} +QTabBar::tab:first { + border-style: solid; + border-left-width:1px; + border-right-width:0px; + border-top-width:1px; + border-bottom-width:1px; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + color: #000000; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(255, 255, 255, 255)); +} +QTabBar::tab:last { + border-style: solid; + border-width:1px; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-right-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + color: #000000; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(255, 255, 255, 255)); +} +QTabBar::tab { + border-style: solid; + border-top-width:1px; + border-bottom-width:1px; + border-left-width:1px; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + color: #000000; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(255, 255, 255, 255)); +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + border-style: solid; + border-left-width:1px; + border-right-color: transparent; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + color: #FFFFFF; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} + +QTabBar::tab:selected, QTabBar::tab:first:selected, QTabBar::tab:hover { + border-style: solid; + border-left-width:1px; + border-bottom-width:1px; + border-top-width:1px; + border-right-color: transparent; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + color: #FFFFFF; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} + +QCheckBox { + color: #000000; + padding: 2px; +} +QCheckBox:disabled { + color: #808086; + padding: 2px; +} + +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: transparent; +} +QCheckBox::indicator:checked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #000000; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QCheckBox::indicator:unchecked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #000000; +} +QRadioButton { + color: 000000; + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #a9b7c6; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #a9b7c6; + background-color: transparent; +} +QStatusBar { + color:#027f7f; +} +QSpinBox { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QDoubleSpinBox { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QTimeEdit { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QDateTimeEdit { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QDateEdit { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} + +QToolBox { + color: #a9b7c6; + background-color:#000000; +} +QToolBox::tab { + color: #a9b7c6; + background-color:#000000; +} +QToolBox::tab:selected { + color: #FFFFFF; + background-color:#000000; +} +QScrollArea { + color: #FFFFFF; + background-color:#000000; +} +QSlider::groove:horizontal { + height: 5px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); +} +QSlider::groove:vertical { + width: 5px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); +} +QSlider::handle:horizontal { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + width: 12px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + height: 12px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal { + background: rgb(181,181,181); +} +QSlider::add-page:vertical { + background: rgb(181,181,181); +} +QSlider::sub-page:horizontal { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); +} +QSlider::sub-page:vertical { + background-color: qlineargradient(spread:pad, y1:0.5, x1:1, y2:0.5, x2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); +} +QScrollBar:horizontal { + max-height: 20px; + border: 1px transparent grey; + margin: 0px 20px 0px 20px; +} +QScrollBar:vertical { + max-width: 20px; + border: 1px transparent grey; + margin: 20px 0px 20px 0px; +} +QScrollBar::handle:horizontal { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + border-radius: 7px; + min-width: 25px; +} +QScrollBar::handle:horizontal:hover { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(147, 200, 200); + border-radius: 7px; + min-width: 25px; +} +QScrollBar::handle:vertical { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + border-radius: 7px; + min-height: 25px; +} +QScrollBar::handle:vertical:hover { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(147, 200, 200); + border-radius: 7px; + min-height: 25px; +} +QScrollBar::add-line:horizontal { + border: 2px transparent grey; + border-top-right-radius: 7px; + border-bottom-right-radius: 7px; + background: rgba(34, 142, 255, 255); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:pressed { + border: 2px transparent grey; + border-top-right-radius: 7px; + border-bottom-right-radius: 7px; + background: rgb(181,181,181); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical { + border: 2px transparent grey; + border-bottom-left-radius: 7px; + border-bottom-right-radius: 7px; + background: rgba(34, 142, 255, 255); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:pressed { + border: 2px transparent grey; + border-bottom-left-radius: 7px; + border-bottom-right-radius: 7px; + background: rgb(181,181,181); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal { + border: 2px transparent grey; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgba(34, 142, 255, 255); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:pressed { + border: 2px transparent grey; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(181,181,181); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical { + border: 2px transparent grey; + border-top-left-radius: 7px; + border-top-right-radius: 7px; + background: rgba(34, 142, 255, 255); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:pressed { + border: 2px transparent grey; + border-top-left-radius: 7px; + border-top-right-radius: 7px; + background: rgb(181,181,181); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::left-arrow:horizontal { + border: 1px transparent grey; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; + width: 6px; + height: 6px; + background: white; +} +QScrollBar::right-arrow:horizontal { + border: 1px transparent grey; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; + width: 6px; + height: 6px; + background: white; +} +QScrollBar::up-arrow:vertical { + border: 1px transparent grey; + border-top-left-radius: 3px; + border-top-right-radius: 3px; + width: 6px; + height: 6px; + background: white; +} +QScrollBar::down-arrow:vertical { + border: 1px transparent grey; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + width: 6px; + height: 6px; + background: white; +} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} diff --git a/GF3StripPatchProcess/QSS/ConsoleStyle.qss b/GF3StripPatchProcess/QSS/ConsoleStyle.qss new file mode 100644 index 0000000..af6c204 --- /dev/null +++ b/GF3StripPatchProcess/QSS/ConsoleStyle.qss @@ -0,0 +1,181 @@ +/* +Dark Console Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 24/05/2018, 17:12. +Available at: https://github.com/GTRONICK/QSS/blob/master/ConsoleStyle.qss +*/ +QWidget { + background-color:rgb(0, 0, 0); + color: rgb(240, 240, 240); + border-color: rgb(58, 58, 58); +} + +QPlainTextEdit { + background-color:rgb(0, 0, 0); + color: rgb(200, 200, 200); + selection-background-color: rgb(255, 153, 0); + selection-color: rgb(0, 0, 0); +} + +QTabWidget::pane { + border-top: 1px solid #000000; +} + +QTabBar::tab { + background-color:rgb(0, 0, 0); + border-style: outset; + border-width: 1px; + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-top-width: 0px; + border-style: solid; + color: rgb(255, 153, 0); + padding: 4px; +} + +QTabBar::tab:selected, QTabBar::tab:hover { + color: rgb(255, 255, 255); + background-color:rgb(0, 0, 0); + border-color:rgb(42, 42, 42); + margin-left: 0px; + margin-right: 0px; + border-bottom-right-radius:4px; + border-bottom-left-radius:4px; +} + +QTabBar::tab:last:selected { + background-color:rgb(0, 0, 0); + border-color:rgb(42, 42, 42); + margin-left: 0px; + margin-right: 0px; + border-bottom-right-radius:4px; + border-bottom-left-radius:4px; +} + +QTabBar::tab:!selected { + margin-bottom: 4px; + border-bottom-right-radius:4px; + border-bottom-left-radius:4px; +} + +QPushButton{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); +} + +QPushButton:hover{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-bottom-color: rgb(115, 115, 115); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(107, 107, 107, 255), stop:1 rgba(157, 157, 157, 255)); +} + +QPushButton:pressed{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(62, 62, 62, 255), stop:1 rgba(22, 22, 22, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); +} + +QPushButton:disabled{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(0, 0, 0); + padding: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(57, 57, 57, 255), stop:1 rgba(77, 77, 77, 255)); +} + +QLineEdit { + border-width: 1px; border-radius: 4px; + border-color: rgb(58, 58, 58); + border-style: inset; + padding: 0 8px; + color: rgb(255, 255, 255); + background:rgb(101, 101, 101); + selection-background-color: rgb(187, 187, 187); + selection-color: rgb(60, 63, 65); +} + +QProgressBar { + text-align: center; + color: rgb(255, 255, 255); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; +} + +QProgressBar::chunk { + background-color: qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(0, 200, 0, 255), stop:1 rgba(30, 230, 30, 255)); + border-radius: 10px; +} + +QMenuBar { + background:rgb(0, 0, 0); + color: rgb(255, 153, 0); +} + +QMenuBar::item { + spacing: 3px; + padding: 1px 4px; + background: transparent; +} + +QMenuBar::item:selected { + background:rgb(115, 115, 115); +} + +QMenu { + border-width: 2px; + border-radius: 10px; + border-color: rgb(255, 153, 0); + border-style: outset; +} + +QMenu::item { + spacing: 3px; + padding: 3px 15px; +} + +QMenu::item:selected { + spacing: 3px; + padding: 3px 15px; + background:rgb(115, 115, 115); + color:rgb(255, 255, 255); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; +} diff --git a/GF3StripPatchProcess/QSS/ElegantDark.qss b/GF3StripPatchProcess/QSS/ElegantDark.qss new file mode 100644 index 0000000..49d2b0b --- /dev/null +++ b/GF3StripPatchProcess/QSS/ElegantDark.qss @@ -0,0 +1,196 @@ +/* +ElegantDark Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 17/04/2018 +Available at: https://github.com/GTRONICK/QSS/blob/master/ElegantDark.qss +*/ +QMainWindow { + background-color:rgb(82, 82, 82); +} +QTextEdit { + background-color:rgb(42, 42, 42); + color: rgb(0, 255, 0); +} +QPushButton{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); +} +QPushButton:hover{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-bottom-color: rgb(115, 115, 115); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(107, 107, 107, 255), stop:1 rgba(157, 157, 157, 255)); +} +QPushButton:pressed{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(62, 62, 62, 255), stop:1 rgba(22, 22, 22, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); +} +QPushButton:disabled{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(0, 0, 0); + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(57, 57, 57, 255), stop:1 rgba(77, 77, 77, 255)); +} +QLineEdit { + border-width: 1px; border-radius: 4px; + border-color: rgb(58, 58, 58); + border-style: inset; + padding: 0 8px; + color: rgb(255, 255, 255); + background:rgb(100, 100, 100); + selection-background-color: rgb(187, 187, 187); + selection-color: rgb(60, 63, 65); +} +QLabel { + color:rgb(255,255,255); +} +QProgressBar { + text-align: center; + color: rgb(240, 240, 240); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; + background-color:rgb(77,77,77); +} +QProgressBar::chunk { + background-color: qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 255), stop:1 rgba(93, 103, 113, 255)); + border-radius: 5px; +} +QMenuBar { + background:rgb(82, 82, 82); +} +QMenuBar::item { + color:rgb(223,219,210); + spacing: 3px; + padding: 1px 4px; + background: transparent; +} + +QMenuBar::item:selected { + background:rgb(115, 115, 115); +} +QMenu::item:selected { + color:rgb(255,255,255); + border-width:2px; + border-style:solid; + padding-left:18px; + padding-right:8px; + padding-top:2px; + padding-bottom:3px; + background:qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 255), stop:1 rgba(93, 103, 113, 255)); + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; +} +QMenu::item { + color:rgb(223,219,210); + background-color:rgb(78,78,78); + padding-left:20px; + padding-top:4px; + padding-bottom:4px; + padding-right:10px; +} +QMenu{ + background-color:rgb(78,78,78); +} +QTabWidget { + color:rgb(0,0,0); + background-color:rgb(247,246,246); +} +QTabWidget::pane { + border-color: rgb(77,77,77); + background-color:rgb(101,101,101); + border-style: solid; + border-width: 1px; + border-radius: 6px; +} +QTabBar::tab { + padding:2px; + color:rgb(250,250,250); + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); + border-style: solid; + border-width: 2px; + border-top-right-radius:4px; + border-top-left-radius:4px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(95, 92, 93, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(95, 92, 93, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(95, 92, 93, 255)); + border-bottom-color: rgb(101,101,101); +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + background-color:rgb(101,101,101); + margin-left: 0px; + margin-right: 1px; +} +QTabBar::tab:!selected { + margin-top: 1px; + margin-right: 1px; +} +QCheckBox { + color:rgb(223,219,210); + padding: 2px; +} +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: rgb(87, 97, 106); + background-color:qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 150), stop:1 rgba(93, 103, 113, 150)); +} +QCheckBox::indicator:checked { + border-radius:4px; + border-style:solid; + border-width:1px; + border-color: rgb(180,180,180); + background-color:qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 255), stop:1 rgba(93, 103, 113, 255)); +} +QCheckBox::indicator:unchecked { + border-radius:4px; + border-style:solid; + border-width:1px; + border-color: rgb(87, 97, 106); + background-color:rgb(255,255,255); +} +QStatusBar { + color:rgb(240,240,240); +} diff --git a/GF3StripPatchProcess/QSS/LICENSE b/GF3StripPatchProcess/QSS/LICENSE new file mode 100644 index 0000000..868ac31 --- /dev/null +++ b/GF3StripPatchProcess/QSS/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Jaime Quiroga + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/GF3StripPatchProcess/QSS/MacOS.qss b/GF3StripPatchProcess/QSS/MacOS.qss new file mode 100644 index 0000000..9a98622 --- /dev/null +++ b/GF3StripPatchProcess/QSS/MacOS.qss @@ -0,0 +1,434 @@ +/* + * MacOS Style Sheet for QT Applications + * Author: Jaime A. Quiroga P. + * Company: GTRONICK + * Last updated: 25/12/2020, 23:10. + * Available at: https://github.com/GTRONICK/QSS/blob/master/MacOS.qss + */ +QMainWindow { + background-color:#ececec; +} +QPushButton, QToolButton, QCommandLinkButton{ + padding: 0 5px 0 5px; + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-right-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-bottom-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-width: 2px; + border-radius: 8px; + color: #616161; + font-weight: bold; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #fbfdfd, stop:0.5 #ffffff, stop:1 #fbfdfd); +} +QPushButton::default, QToolButton::default, QCommandLinkButton::default{ + border: 2px solid transparent; + color: #FFFFFF; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #84afe5, stop:1 #1168e4); +} +QPushButton:hover, QToolButton:hover, QCommandLinkButton:hover{ + color: #3d3d3d; +} +QPushButton:pressed, QToolButton:pressed, QCommandLinkButton:pressed{ + color: #aeaeae; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #ffffff, stop:0.5 #fbfdfd, stop:1 #ffffff); +} +QPushButton:disabled, QToolButton:disabled, QCommandLinkButton:disabled{ + color: #616161; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #dce7eb, stop:0.5 #e0e8eb, stop:1 #dee7ec); +} +QLineEdit, QTextEdit, QPlainTextEdit, QSpinBox, QDoubleSpinBox, QTimeEdit, QDateEdit, QDateTimeEdit { + border-width: 2px; + border-radius: 8px; + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + background-color: #f4f4f4; + color: #3d3d3d; +} +QLineEdit:focus, QTextEdit:focus, QPlainTextEdit:focus, QSpinBox:focus, QDoubleSpinBox:focus, QTimeEdit:focus, QDateEdit:focus, QDateTimeEdit:focus { + border-width: 2px; + border-radius: 8px; + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 #85b7e3, stop:1 #9ec1db); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #85b7e3, stop:1 #9ec1db); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #85b7e3, stop:1 #9ec1db); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 #85b7e3, stop:1 #9ec1db); + background-color: #f4f4f4; + color: #3d3d3d; +} +QLineEdit:disabled, QTextEdit:disabled, QPlainTextEdit:disabled, QSpinBox:disabled, QDoubleSpinBox:disabled, QTimeEdit:disabled, QDateEdit:disabled, QDateTimeEdit:disabled { + color: #b9b9b9; +} +QSpinBox::up-button, QDoubleSpinBox::up-button, QTimeEdit::up-button, QDateEdit::up-button, QDateTimeEdit::up-button { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 15px; + color: #272727; + border-left-width: 1px; + border-left-color: darkgray; + border-left-style: solid; + border-top-right-radius: 3px; + padding: 3px; +} +QSpinBox::down-button, QDoubleSpinBox::down-button, QTimeEdit::down-button, QDateEdit::down-button, QDateTimeEdit::down-button { + subcontrol-origin: padding; + subcontrol-position: bottom right; + width: 15px; + color: #272727; + border-left-width: 1px; + border-left-color: darkgray; + border-left-style: solid; + border-bottom-right-radius: 3px; + padding: 3px; +} +QSpinBox::up-button:pressed, QDoubleSpinBox::up-button:pressed, QTimeEdit::up-button:pressed, QDateEdit::up-button:pressed, QDateTimeEdit::up-button:pressed { + color: #aeaeae; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #ffffff, stop:0.5 #fbfdfd, stop:1 #ffffff); +} +QSpinBox::down-button:pressed, QDoubleSpinBox::down-button:pressed, QTimeEdit::down-button:pressed, QDateEdit::down-button:pressed, QDateTimeEdit::down-button:pressed { + color: #aeaeae; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #ffffff, stop:0.5 #fbfdfd, stop:1 #ffffff); +} +QSpinBox::up-button:hover, QDoubleSpinBox::up-button:hover, QTimeEdit::up-button:hover, QDateEdit::up-button:hover, QDateTimeEdit::up-button:hover { + color: #FFFFFF; + border-top-right-radius: 5px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #84afe5, stop:1 #1168e4); + +} +QSpinBox::down-button:hover, QDoubleSpinBox::down-button:hover, QTimeEdit::down-button:hover, QDateEdit::down-button:hover, QDateTimeEdit::down-button:hover { + color: #FFFFFF; + border-bottom-right-radius: 5px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #84afe5, stop:1 #1168e4); +} +QSpinBox::up-arrow, QDoubleSpinBox::up-arrow, QTimeEdit::up-arrow, QDateEdit::up-arrow, QDateTimeEdit::up-arrow { + image: url(/usr/share/icons/Adwaita/16x16/actions/go-up-symbolic.symbolic.png); +} +QSpinBox::down-arrow, QDoubleSpinBox::down-arrow, QTimeEdit::down-arrow, QDateEdit::down-arrow, QDateTimeEdit::down-arrow { + image: url(/usr/share/icons/Adwaita/16x16/actions/go-down-symbolic.symbolic.png); +} +QProgressBar { + max-height: 8px; + text-align: center; + font: italic bold 11px; + color: #3d3d3d; + border: 1px solid transparent; + border-radius:4px; + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #ddd5d5, stop:0.5 #dad3d3, stop:1 #ddd5d5); +} +QProgressBar::chunk { + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1); + border-radius: 4px; +} +QProgressBar:disabled { + color: #616161; +} +QProgressBar::chunk:disabled { + background-color: #aeaeae; +} +QSlider::groove { + border: 1px solid #bbbbbb; + background-color: #52595d; + border-radius: 4px; +} +QSlider::groove:horizontal { + height: 6px; +} +QSlider::groove:vertical { + width: 6px; +} +QSlider::handle:horizontal { + background: #ffffff; + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + width: 12px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: #ffffff; + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + height: 12px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page, QSlider::sub-page { + border: 1px transparent; + background-color: #52595d; + border-radius: 4px; +} +QSlider::add-page:horizontal { + background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #ddd5d5, stop:0.5 #dad3d3, stop:1 #ddd5d5); +} +QSlider::sub-page:horizontal { + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1); +} +QSlider::add-page:vertical { + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1); +} +QSlider::sub-page:vertical { + background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #ddd5d5, stop:0.5 #dad3d3, stop:1 #ddd5d5); +} +QSlider::add-page:horizontal:disabled, QSlider::sub-page:horizontal:disabled, QSlider::add-page:vertical:disabled, QSlider::sub-page:vertical:disabled { + background: #b9b9b9; +} +QComboBox, QFontComboBox { + border-width: 2px; + border-radius: 8px; + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + background-color: #f4f4f4; + color: #272727; + padding-left: 5px; +} +QComboBox:editable, QComboBox:!editable, QComboBox::drop-down:editable, QComboBox:!editable:on, QComboBox::drop-down:editable:on { + background: #ffffff; +} +QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 15px; + color: #272727; + border-left-width: 1px; + border-left-color: darkgray; + border-left-style: solid; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} +QComboBox::down-arrow { + image: url(/usr/share/icons/Adwaita/16x16/actions/go-down-symbolic.symbolic.png); /*Adawaita icon thene*/ +} + +QComboBox::down-arrow:on { + top: 1px; + left: 1px; +} +QComboBox QAbstractItemView { + border: 1px solid darkgray; + border-radius: 8px; + selection-background-color: #dadada; + selection-color: #272727; + color: #272727; + background: white; +} +QLabel, QCheckBox, QRadioButton { + color: #272727; +} +QCheckBox { + padding: 2px; +} +QCheckBox:disabled, QRadioButton:disabled { + color: #808086; + padding: 2px; +} + +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: transparent; +} +QCheckBox::indicator:checked { + image: url(/usr/share/icons/Adwaita/16x16/actions/object-select-symbolic.symbolic.png); + height: 15px; + width: 15px; + border-style:solid; + border-width: 1px; + border-color: #48a5fd; + color: #ffffff; + border-radius: 3px; + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #48a5fd, stop:0.5 #329cfb, stop:1 #48a5fd); +} +QCheckBox::indicator:unchecked { + + height: 15px; + width: 15px; + border-style:solid; + border-width: 1px; + border-color: #48a5fd; + border-radius: 3px; + background-color: #fbfdfa; +} +QLCDNumber { + color: #616161;; +} +QMenuBar { + background-color: #ececec; +} +QMenuBar::item { + color: #616161; + spacing: 3px; + padding: 1px 4px; + background-color: #ececec; +} + +QMenuBar::item:selected { + background-color: #dadada; + color: #3d3d3d; +} +QMenu { + background-color: #ececec; +} +QMenu::item:selected { + background-color: #dadada; + color: #3d3d3d; +} +QMenu::item { + color: #616161;; + background-color: #e0e0e0; +} +QTabWidget { + color:rgb(0,0,0); + background-color:#000000; +} +QTabWidget::pane { + border-color: #050a0e; + background-color: #e0e0e0; + border-width: 1px; + border-radius: 4px; + position: absolute; + top: -0.5em; + padding-top: 0.5em; +} + +QTabWidget::tab-bar { + alignment: center; +} + +QTabBar::tab { + border-bottom: 1px solid #c0c0c0; + padding: 3px; + color: #272727; + background-color: #fefefc; + margin-left:0px; +} +QTabBar::tab:!last { + border-right: 1px solid; + border-right-color: #c0c0c0; + border-bottom-color: #c0c0c0; +} +QTabBar::tab:first { + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; +} +QTabBar::tab:last { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + color: #FFFFFF; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #84afe5, stop:1 #1168e4); +} +QRadioButton::indicator { + height: 14px; + width: 14px; + border-style:solid; + border-radius:7px; + border-width: 1px; +} +QRadioButton::indicator:checked { + border-color: #48a5fd; + background-color: qradialgradient(cx:0.5, cy:0.5, radius:0.4,fx:0.5, fy:0.5, stop:0 #ffffff, stop:0.5 #ffffff, stop:0.6 #48a5fd, stop:1 #48a5fd); +} +QRadioButton::indicator:!checked { + border-color: #a9b7c6; + background-color: #fbfdfa; +} +QStatusBar { + color:#027f7f; +} + +QDial { + background: #16a085; +} + +QToolBox { + color: #a9b7c6; + background-color: #222b2e; +} +QToolBox::tab { + color: #a9b7c6; + background-color:#222b2e; +} +QToolBox::tab:selected { + color: #FFFFFF; + background-color:#222b2e; +} +QScrollArea { + color: #FFFFFF; + background-color:#222b2e; +} + +QScrollBar:horizontal { + max-height: 10px; + border: 1px transparent grey; + margin: 0px 20px 0px 20px; + background: transparent; +} +QScrollBar:vertical { + max-width: 10px; + border: 1px transparent grey; + margin: 20px 0px 20px 0px; + background: transparent; +} +QScrollBar::handle:vertical, QScrollBar::handle:horizontal { + background: #52595d; + border-style: transparent; + border-radius: 4px; + min-height: 25px; +} +QScrollBar::handle:horizontal:hover, QScrollBar::handle:vertical:hover { + background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1); +} +QScrollBar::add-line, QScrollBar::sub-line { + border: 2px transparent grey; + border-radius: 4px; + subcontrol-origin: margin; + background: #b9b9b9; +} +QScrollBar::add-line:horizontal { + width: 20px; + subcontrol-position: right; +} +QScrollBar::add-line:vertical { + height: 20px; + subcontrol-position: bottom; +} +QScrollBar::sub-line:horizontal { + width: 20px; + subcontrol-position: left; +} +QScrollBar::sub-line:vertical { + height: 20px; + subcontrol-position: top; +} +QScrollBar::add-line:vertical:pressed, QScrollBar::add-line:horizontal:pressed, QScrollBar::sub-line:horizontal:pressed, QScrollBar::sub-line:vertical:pressed { + background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1); +} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal, QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} +QScrollBar::up-arrow:vertical { + image: url(/usr/share/icons/Adwaita/16x16/actions/go-up-symbolic.symbolic.png); +} +QScrollBar::down-arrow:vertical { + image: url(/usr/share/icons/Adwaita/16x16/actions/go-down-symbolic.symbolic.png); +} +QScrollBar::left-arrow:horizontal { + image: url(/usr/share/icons/Adwaita/16x16/actions/go-previous-symbolic.symbolic.png); +} +QScrollBar::right-arrow:horizontal { + image: url(/usr/share/icons/Adwaita/16x16/actions/go-next-symbolic.symbolic.png); +} diff --git a/GF3StripPatchProcess/QSS/ManjaroMix.qss b/GF3StripPatchProcess/QSS/ManjaroMix.qss new file mode 100644 index 0000000..92301a5 --- /dev/null +++ b/GF3StripPatchProcess/QSS/ManjaroMix.qss @@ -0,0 +1,531 @@ +/* +ManjaroMix Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 25/02/2020, 15:42. +Available at: https://github.com/GTRONICK/QSS/blob/master/ManjaroMix.qss +*/ +QMainWindow { + background-color:#151a1e; +} +QCalendar { + background-color: #151a1e; +} +QTextEdit { + border-width: 1px; + border-style: solid; + border-color: #4fa08b; + background-color: #222b2e; + color: #d3dae3; +} +QPlainTextEdit { + border-width: 1px; + border-style: solid; + border-color: #4fa08b; + background-color: #222b2e; + color: #d3dae3; +} +QToolButton { + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: rgb(255,255,255); +} +QToolButton:hover{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(197, 197, 197), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(197, 197, 197)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QToolButton:pressed{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(142,142,142); +} +QPushButton{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: #151a1e; +} +QPushButton::default{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #FFFFFF; + padding: 2px; + background-color: #151a1e;; +} +QPushButton:hover{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: #1c1f1f; +} +QPushButton:pressed{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: #2c2f2f; +} +QPushButton:disabled{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: #808086; + padding: 2px; + background-color: rgb(142,142,142); +} +QLineEdit { + border-width: 1px; + border-style: solid; + border-color: #4fa08b; + background-color: #222b2e; + color: #d3dae3; +} +QLabel { + color: #d3dae3; +} +QLCDNumber { + color: #4d9b87; +} +QProgressBar { + text-align: center; + color: #d3dae3; + border-radius: 10px; + border-color: transparent; + border-style: solid; + background-color: #52595d; +} +QProgressBar::chunk { + background-color: #214037 ; + border-radius: 10px; +} +QMenuBar { + background-color: #151a1e; +} +QMenuBar::item { + color: #d3dae3; + spacing: 3px; + padding: 1px 4px; + background-color: #151a1e; +} + +QMenuBar::item:selected { + background-color: #252a2e; + color: #FFFFFF; +} +QMenu { + background-color: #151a1e; +} +QMenu::item:selected { + background-color: #252a2e; + color: #FFFFFF; +} +QMenu::item { + color: #d3dae3; + background-color: #151a1e; +} +QTabWidget { + color:rgb(0,0,0); + background-color:#000000; +} +QTabWidget::pane { + border-color: #050a0e; + background-color: #1e282c; + border-style: solid; + border-width: 1px; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; +} +QTabBar::tab:first { + border-style: solid; + border-left-width:1px; + border-right-width:0px; + border-top-width:1px; + border-bottom-width:0px; + border-top-color: #050a0e; + border-left-color: #050a0e; + border-bottom-color: #050a0e; + border-top-left-radius: 4px; + color: #d3dae3; + padding: 3px; + margin-left:0px; + background-color: #151a1e; +} +QTabBar::tab:last { + border-style: solid; + border-top-width:1px; + border-left-width:1px; + border-right-width:1px; + border-bottom-width:0px; + border-color: #050a0e; + border-top-right-radius: 4px; + color: #d3dae3; + padding: 3px; + margin-left:0px; + background-color: #151a1e; +} +QTabBar::tab { + border-style: solid; + border-top-width:1px; + border-bottom-width:0px; + border-left-width:1px; + border-top-color: #050a0e; + border-left-color: #050a0e; + border-bottom-color: #050a0e; + color: #d3dae3; + padding: 3px; + margin-left:0px; + background-color: #151a1e; +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + border-style: solid; + border-left-width:1px; + border-bottom-width:0px; + border-right-color: transparent; + border-top-color: #050a0e; + border-left-color: #050a0e; + border-bottom-color: #050a0e; + color: #FFFFFF; + padding: 3px; + margin-left:0px; + background-color: #1e282c; +} + +QTabBar::tab:selected, QTabBar::tab:first:selected, QTabBar::tab:hover { + border-style: solid; + border-left-width:1px; + border-bottom-width:0px; + border-top-width:1px; + border-right-color: transparent; + border-top-color: #050a0e; + border-left-color: #050a0e; + border-bottom-color: #050a0e; + color: #FFFFFF; + padding: 3px; + margin-left:0px; + background-color: #1e282c; +} + +QCheckBox { + color: #d3dae3; + padding: 2px; +} +QCheckBox:disabled { + color: #808086; + padding: 2px; +} + +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: transparent; +} +QCheckBox::indicator:checked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #4fa08b; + color: #000000; + background-color: qradialgradient(cx:0.4, cy:0.4, radius: 1.5,fx:0, fy:0, stop:0 #1e282c, stop:0.3 #1e282c, stop:0.4 #4fa08b, stop:0.5 #1e282c, stop:1 #1e282c); +} +QCheckBox::indicator:unchecked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #4fa08b; + color: #000000; +} +QRadioButton { + color: #d3dae3; + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #4fa08b; + color: #a9b7c6; + background-color: qradialgradient(cx:0.5, cy:0.5, radius:0.4,fx:0.5, fy:0.5, stop:0 #4fa08b, stop:1 #1e282c); +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #4fa08b; + color: #a9b7c6; + background-color: transparent; +} +QStatusBar { + color:#027f7f; +} +QSpinBox { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QDoubleSpinBox { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QTimeEdit { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QDateTimeEdit { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QDateEdit { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QFontComboBox { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QComboBox { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} + +QDial { + background: #16a085; +} + +QToolBox { + color: #a9b7c6; + background-color: #222b2e; +} +QToolBox::tab { + color: #a9b7c6; + background-color:#222b2e; +} +QToolBox::tab:selected { + color: #FFFFFF; + background-color:#222b2e; +} +QScrollArea { + color: #FFFFFF; + background-color:#222b2e; +} +QSlider::groove:horizontal { + height: 5px; + background-color: #52595d; +} +QSlider::groove:vertical { + width: 5px; + background-color: #52595d; +} +QSlider::handle:horizontal { + background: #1a2224; + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + width: 12px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: #1a2224; + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + height: 12px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal { + background: #52595d; +} +QSlider::add-page:vertical { + background: #52595d; +} +QSlider::sub-page:horizontal { + background-color: #15433a; +} +QSlider::sub-page:vertical { + background-color: #15433a; +} +QScrollBar:horizontal { + max-height: 10px; + border: 1px transparent grey; + margin: 0px 20px 0px 20px; + background: transparent; +} +QScrollBar:vertical { + max-width: 10px; + border: 1px transparent grey; + margin: 20px 0px 20px 0px; + background: transparent; +} +QScrollBar::handle:horizontal { + background: #52595d; + border-style: transparent; + border-radius: 4px; + min-width: 25px; +} +QScrollBar::handle:horizontal:hover { + background: #58a492; + border-style: transparent; + border-radius: 4px; + min-width: 25px; +} +QScrollBar::handle:vertical { + background: #52595d; + border-style: transparent; + border-radius: 4px; + min-height: 25px; +} +QScrollBar::handle:vertical:hover { + background: #58a492; + border-style: transparent; + border-radius: 4px; + min-height: 25px; +} +QScrollBar::add-line:horizontal { + border: 2px transparent grey; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + background: #15433a; + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:pressed { + border: 2px transparent grey; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(181,181,181); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical { + border: 2px transparent grey; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: #15433a; + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:pressed { + border: 2px transparent grey; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(181,181,181); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal { + border: 2px transparent grey; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + background: #15433a; + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:pressed { + border: 2px transparent grey; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + background: rgb(181,181,181); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical { + border: 2px transparent grey; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + background: #15433a; + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:pressed { + border: 2px transparent grey; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + background: rgb(181,181,181); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} + +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} diff --git a/GF3StripPatchProcess/QSS/MaterialDark.qss b/GF3StripPatchProcess/QSS/MaterialDark.qss new file mode 100644 index 0000000..c5a94aa --- /dev/null +++ b/GF3StripPatchProcess/QSS/MaterialDark.qss @@ -0,0 +1,390 @@ +/* +Material Dark Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Inspired on https://github.com/jxfwinter/qt-material-stylesheet +Company: GTRONICK +Last updated: 04/12/2018, 15:00. +Available at: https://github.com/GTRONICK/QSS/blob/master/MaterialDark.qss +*/ +QMainWindow { + background-color:#1e1d23; +} +QDialog { + background-color:#1e1d23; +} +QColorDialog { + background-color:#1e1d23; +} +QTextEdit { + background-color:#1e1d23; + color: #a9b7c6; +} +QPlainTextEdit { + selection-background-color:#007b50; + background-color:#1e1d23; + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-width: 1px; + color: #a9b7c6; +} +QPushButton{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-width: 1px; + border-style: solid; + color: #a9b7c6; + padding: 2px; + background-color: #1e1d23; +} +QPushButton::default{ + border-style: inset; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #04b97f; + border-width: 1px; + color: #a9b7c6; + padding: 2px; + background-color: #1e1d23; +} +QToolButton { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #04b97f; + border-bottom-width: 1px; + border-style: solid; + color: #a9b7c6; + padding: 2px; + background-color: #1e1d23; +} +QToolButton:hover{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #37efba; + border-bottom-width: 2px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 1px; + background-color: #1e1d23; +} +QPushButton:hover{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #37efba; + border-bottom-width: 1px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 2px; + background-color: #1e1d23; +} +QPushButton:pressed{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #37efba; + border-bottom-width: 2px; + border-style: solid; + color: #37efba; + padding-bottom: 1px; + background-color: #1e1d23; +} +QPushButton:disabled{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #808086; + border-bottom-width: 2px; + border-style: solid; + color: #808086; + padding-bottom: 1px; + background-color: #1e1d23; +} +QLineEdit { + border-width: 1px; border-radius: 4px; + border-color: rgb(58, 58, 58); + border-style: inset; + padding: 0 8px; + color: #a9b7c6; + background:#1e1d23; + selection-background-color:#007b50; + selection-color: #FFFFFF; +} +QLabel { + color: #a9b7c6; +} +QLCDNumber { + color: #37e6b4; +} +QProgressBar { + text-align: center; + color: rgb(240, 240, 240); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; + background-color:#1e1d23; +} +QProgressBar::chunk { + background-color: #04b97f; + border-radius: 5px; +} +QMenuBar { + background-color: #1e1d23; +} +QMenuBar::item { + color: #a9b7c6; + spacing: 3px; + padding: 1px 4px; + background: #1e1d23; +} + +QMenuBar::item:selected { + background:#1e1d23; + color: #FFFFFF; +} +QMenu::item:selected { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: #04b97f; + border-bottom-color: transparent; + border-left-width: 2px; + color: #FFFFFF; + padding-left:15px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; + background-color: #1e1d23; +} +QMenu::item { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + border-style: solid; + color: #a9b7c6; + padding-left:17px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; + background-color: #1e1d23; +} +QMenu{ + background-color:#1e1d23; +} +QTabWidget { + color:rgb(0,0,0); + background-color:#1e1d23; +} +QTabWidget::pane { + border-color: rgb(77,77,77); + background-color:#1e1d23; + border-style: solid; + border-width: 1px; + border-radius: 6px; +} +QTabBar::tab { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + border-style: solid; + color: #808086; + padding: 3px; + margin-left:3px; + background-color: #1e1d23; +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #04b97f; + border-bottom-width: 2px; + border-style: solid; + color: #FFFFFF; + padding-left: 3px; + padding-bottom: 2px; + margin-left:3px; + background-color: #1e1d23; +} + +QCheckBox { + color: #a9b7c6; + padding: 2px; +} +QCheckBox:disabled { + color: #808086; + padding: 2px; +} + +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: rgb(87, 97, 106); + background-color:#1e1d23; +} +QCheckBox::indicator:checked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #04b97f; + color: #a9b7c6; + background-color: #04b97f; +} +QCheckBox::indicator:unchecked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #04b97f; + color: #a9b7c6; + background-color: transparent; +} +QRadioButton { + color: #a9b7c6; + background-color: #1e1d23; + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #04b97f; + color: #a9b7c6; + background-color: #04b97f; +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #04b97f; + color: #a9b7c6; + background-color: transparent; +} +QStatusBar { + color:#027f7f; +} +QSpinBox { + color: #a9b7c6; + background-color: #1e1d23; +} +QDoubleSpinBox { + color: #a9b7c6; + background-color: #1e1d23; +} +QTimeEdit { + color: #a9b7c6; + background-color: #1e1d23; +} +QDateTimeEdit { + color: #a9b7c6; + background-color: #1e1d23; +} +QDateEdit { + color: #a9b7c6; + background-color: #1e1d23; +} +QComboBox { + color: #a9b7c6; + background: #1e1d23; +} +QComboBox:editable { + background: #1e1d23; + color: #a9b7c6; + selection-background-color: #1e1d23; +} +QComboBox QAbstractItemView { + color: #a9b7c6; + background: #1e1d23; + selection-color: #FFFFFF; + selection-background-color: #1e1d23; +} +QComboBox:!editable:on, QComboBox::drop-down:editable:on { + color: #a9b7c6; + background: #1e1d23; +} +QFontComboBox { + color: #a9b7c6; + background-color: #1e1d23; +} +QToolBox { + color: #a9b7c6; + background-color: #1e1d23; +} +QToolBox::tab { + color: #a9b7c6; + background-color: #1e1d23; +} +QToolBox::tab:selected { + color: #FFFFFF; + background-color: #1e1d23; +} +QScrollArea { + color: #FFFFFF; + background-color: #1e1d23; +} +QSlider::groove:horizontal { + height: 5px; + background: #04b97f; +} +QSlider::groove:vertical { + width: 5px; + background: #04b97f; +} +QSlider::handle:horizontal { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f); + border: 1px solid #5c5c5c; + width: 14px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: qlineargradient(x1:1, y1:1, x2:0, y2:0, stop:0 #b4b4b4, stop:1 #8f8f8f); + border: 1px solid #5c5c5c; + height: 14px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal { + background: white; +} +QSlider::add-page:vertical { + background: white; +} +QSlider::sub-page:horizontal { + background: #04b97f; +} +QSlider::sub-page:vertical { + background: #04b97f; +} diff --git a/GF3StripPatchProcess/QSS/NeonButtons.qss b/GF3StripPatchProcess/QSS/NeonButtons.qss new file mode 100644 index 0000000..8065250 --- /dev/null +++ b/GF3StripPatchProcess/QSS/NeonButtons.qss @@ -0,0 +1,47 @@ +/* +Neon Style Sheet for QT Applications (QpushButton) +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 24/10/2020, 15:42. +Available at: https://github.com/GTRONICK/QSS/blob/master/NeonButtons.qss +*/ +QPushButton{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: #100E19; +} +QPushButton::default{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #FFFFFF; + padding: 2px; + background-color: #151a1e; +} +QPushButton:hover{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:1, stop:0 #C0DB50, stop:0.4 #C0DB50, stop:0.5 #100E19, stop:1 #100E19); + border-bottom-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:1, stop:0 #100E19, stop:0.5 #100E19, stop:0.6 #C0DB50, stop:1 #C0DB50); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #C0DB50, stop:0.3 #C0DB50, stop:0.7 #100E19, stop:1 #100E19); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 #C0DB50, stop:0.3 #C0DB50, stop:0.7 #100E19, stop:1 #100E19); + border-width: 2px; + border-radius: 1px; + color: #d3dae3; + padding: 2px; +} +QPushButton:pressed{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:1, stop:0 #d33af1, stop:0.4 #d33af1, stop:0.5 #100E19, stop:1 #100E19); + border-bottom-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:1, stop:0 #100E19, stop:0.5 #100E19, stop:0.6 #d33af1, stop:1 #d33af1); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #d33af1, stop:0.3 #d33af1, stop:0.7 #100E19, stop:1 #100E19); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 #d33af1, stop:0.3 #d33af1, stop:0.7 #100E19, stop:1 #100E19); + border-width: 2px; + border-radius: 1px; + color: #d3dae3; + padding: 2px; +} \ No newline at end of file diff --git a/GF3StripPatchProcess/QSS/QSS_IMG/go-down-symbolic.symbolic.png b/GF3StripPatchProcess/QSS/QSS_IMG/go-down-symbolic.symbolic.png new file mode 100644 index 0000000..bfa7706 Binary files /dev/null and b/GF3StripPatchProcess/QSS/QSS_IMG/go-down-symbolic.symbolic.png differ diff --git a/GF3StripPatchProcess/QSS/QSS_IMG/go-next-symbolic.symbolic.png b/GF3StripPatchProcess/QSS/QSS_IMG/go-next-symbolic.symbolic.png new file mode 100644 index 0000000..f2aa968 Binary files /dev/null and b/GF3StripPatchProcess/QSS/QSS_IMG/go-next-symbolic.symbolic.png differ diff --git a/GF3StripPatchProcess/QSS/QSS_IMG/go-previous-symbolic.symbolic.png b/GF3StripPatchProcess/QSS/QSS_IMG/go-previous-symbolic.symbolic.png new file mode 100644 index 0000000..f688c3c Binary files /dev/null and b/GF3StripPatchProcess/QSS/QSS_IMG/go-previous-symbolic.symbolic.png differ diff --git a/GF3StripPatchProcess/QSS/QSS_IMG/go-up-symbolic.symbolic.png b/GF3StripPatchProcess/QSS/QSS_IMG/go-up-symbolic.symbolic.png new file mode 100644 index 0000000..ea3ce32 Binary files /dev/null and b/GF3StripPatchProcess/QSS/QSS_IMG/go-up-symbolic.symbolic.png differ diff --git a/GF3StripPatchProcess/QSS/QSS_IMG/object-select-symbolic.symbolic.png b/GF3StripPatchProcess/QSS/QSS_IMG/object-select-symbolic.symbolic.png new file mode 100644 index 0000000..ef1034a Binary files /dev/null and b/GF3StripPatchProcess/QSS/QSS_IMG/object-select-symbolic.symbolic.png differ diff --git a/GF3StripPatchProcess/QSS/README.md b/GF3StripPatchProcess/QSS/README.md new file mode 100644 index 0000000..ec16dcc --- /dev/null +++ b/GF3StripPatchProcess/QSS/README.md @@ -0,0 +1,45 @@ +### QT StyleSheet templates ### +Themes available: +1. [Ubuntu](https://github.com/GTRONICK/QSS/blob/master/Ubuntu.qss) + +![Ubuntu theme screenshot](https://i.imgur.com/i8zVYwL.png) + +2. [ElegantDark](https://github.com/GTRONICK/QSS/blob/master/ElegantDark.qss) + +![ElegantDark theme screenshot](https://i.imgur.com/AUb7R7P.png) + +3. [MaterialDark](https://github.com/GTRONICK/QSS/blob/master/MaterialDark.qss) + +![MaterialDark theme screenshot](https://i.imgur.com/ViEQxdh.png) + +4. [ConsoleStyle](https://github.com/GTRONICK/QSS/blob/master/ConsoleStyle.qss) + +![ConsoleStyle theme screenshot](https://i.imgur.com/E10ukaA.png) + +5. [AMOLED](https://github.com/GTRONICK/QSS/blob/master/AMOLED.qss) + +![AMOLED theme screenshot](https://i.imgur.com/M7RIx4c.png) + +6. [Aqua](https://github.com/GTRONICK/QSS/blob/master/Aqua.qss) + +![Aqua theme screenshot](https://i.imgur.com/i8zVYwL.png) + +## The ManjaroMix Theme!: Includes a radial gradient for Checkboxes, and minimalist arrows for scrollbars. ## +7. [ManjaroMix](https://github.com/GTRONICK/QSS/blob/master/ManjaroMix.qss) + +![ManjaroMix theme screenshot](https://i.imgur.com/7zrMDMH.png) + +8. [NeonButtons](https://github.com/GTRONICK/QSS/blob/master/NeonButtons.qss) + +![NeonButtons screenshot](https://i.imgur.com/IqTSQG2.png) +![NeonButtons screenshot](https://i.imgur.com/l4im5Ve.png) + +## MacOS Theme!: Reduced code, image integration through URL resources. ## +9. [MacOS](https://github.com/GTRONICK/QSS/blob/master/MacOS.qss) + +![MacOS](https://i.imgur.com/quEgiVe.png) +**Added images in QSS_IMG folder** + +Stay tunned!, this files are being updated frequently. +*Consider donating :)* **PayPal Account:** gtronick@gmail.com + diff --git a/GF3StripPatchProcess/QSS/Ubuntu.qss b/GF3StripPatchProcess/QSS/Ubuntu.qss new file mode 100644 index 0000000..5f713c1 --- /dev/null +++ b/GF3StripPatchProcess/QSS/Ubuntu.qss @@ -0,0 +1,496 @@ +/* +Ubuntu Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 01/10/2021 (dd/mm/yyyy), 15:18. +Available at: https://github.com/GTRONICK/QSS/blob/master/Ubuntu.qss +*/ +QMainWindow { + background-color:#f0f0f0; +} +QCheckBox { + padding:2px; +} +QCheckBox:hover { + border:1px solid rgb(255,150,60); + border-radius:4px; + padding: 1px; + background-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(190, 90, 50, 50), stop:1 rgba(250, 130, 40, 50)); +} +QCheckBox::indicator:checked { + border:1px solid rgb(246, 134, 86); + border-radius:4px; + background-color:rgb(246, 134, 86) +} +QCheckBox::indicator:unchecked { + border-width:1px solid rgb(246, 134, 86); + border-radius:4px; + background-color:rgb(255,255,255); +} +QColorDialog { + background-color:#f0f0f0; +} +QComboBox { + color:rgb(81,72,65); + background: #ffffff; +} +QComboBox:editable { + selection-color:rgb(81,72,65); + selection-background-color: #ffffff; +} +QComboBox QAbstractItemView { + selection-color: #ffffff; + selection-background-color: rgb(246, 134, 86); +} +QComboBox:!editable:on, QComboBox::drop-down:editable:on { + color: #1e1d23; +} +QDateTimeEdit, QDateEdit, QDoubleSpinBox, QFontComboBox { + color:rgb(81,72,65); + background-color: #ffffff; +} + +QDialog { + background-color:#f0f0f0; +} + +QLabel,QLineEdit { + color:rgb(17,17,17); +} +QLineEdit { + background-color:rgb(255,255,255); + selection-background-color:rgb(236,116,64); +} +QMenuBar { + color:rgb(223,219,210); + background-color:rgb(65,64,59); +} +QMenuBar::item { + padding-top:4px; + padding-left:4px; + padding-right:4px; + color:rgb(223,219,210); + background-color:rgb(65,64,59); +} +QMenuBar::item:selected { + color:rgb(255,255,255); + padding-top:2px; + padding-left:2px; + padding-right:2px; + border-top-width:2px; + border-left-width:2px; + border-right-width:2px; + border-top-right-radius:4px; + border-top-left-radius:4px; + border-style:solid; + background-color:rgb(65,64,59); + border-top-color: rgb(47,47,44); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(90, 87, 78, 255), stop:1 rgba(47,47,44, 255)); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 rgba(90, 87, 78, 255), stop:1 rgba(47,47,44, 255)); +} +QMenu { + color:rgb(223,219,210); + background-color:rgb(65,64,59); +} +QMenu::item { + color:rgb(223,219,210); + padding:4px 10px 4px 20px; +} +QMenu::item:selected { + color:rgb(255,255,255); + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(225, 108, 54, 255), stop:1 rgba(246, 134, 86, 255)); + border-style:solid; + border-width:3px; + padding:4px 7px 4px 17px; + border-bottom-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(175,85,48,255), stop:1 rgba(236,114,67, 255)); + border-top-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); + border-right-color:qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); + border-left-color:qlineargradient(spread:pad, x1:1, y1:0.5, x2:0, y2:0.5, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); +} +QPlainTextEdit { + border: 1px solid transparent; + color:rgb(17,17,17); + selection-background-color:rgb(236,116,64); + background-color: #FFFFFF; +} +QProgressBar { + text-align: center; + color: rgb(0, 0, 0); + border: 1px inset rgb(150,150,150); + border-radius: 10px; + background-color:rgb(221,221,219); +} +QProgressBar::chunk:horizontal { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(225, 108, 54, 255), stop:1 rgba(246, 134, 86, 255)); + border:1px solid; + border-radius:8px; + border-bottom-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(175,85,48,255), stop:1 rgba(236,114,67, 255)); + border-top-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); + border-right-color:qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); + border-left-color:qlineargradient(spread:pad, x1:1, y1:0.5, x2:0, y2:0.5, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); +} +QPushButton{ + color:rgb(17,17,17); + border-width: 1px; + border-radius: 6px; + border-bottom-color: rgb(150,150,150); + border-right-color: rgb(165,165,165); + border-left-color: rgb(165,165,165); + border-top-color: rgb(180,180,180); + border-style: solid; + padding: 4px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(220, 220, 220, 255), stop:1 rgba(255, 255, 255, 255)); +} +QPushButton:hover{ + color:rgb(17,17,17); + border-width: 1px; + border-radius:6px; + border-top-color: rgb(255,150,60); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 255)); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 255)); + border-bottom-color: rgb(200,70,20); + border-style: solid; + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(220, 220, 220, 255), stop:1 rgba(255, 255, 255, 255)); +} +QPushButton:default{ + color:rgb(17,17,17); + border-width: 1px; + border-radius:6px; + border-top-color: rgb(255,150,60); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 255)); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 255)); + border-bottom-color: rgb(200,70,20); + border-style: solid; + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(220, 220, 220, 255), stop:1 rgba(255, 255, 255, 255)); +} +QPushButton:pressed{ + color:rgb(17,17,17); + border-width: 1px; + border-radius: 6px; + border-width: 1px; + border-top-color: rgba(255,150,60,200); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 200)); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 200)); + border-bottom-color: rgba(200,70,20,200); + border-style: solid; + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(220, 220, 220, 255), stop:1 rgba(255, 255, 255, 255)); +} +QPushButton:disabled{ + color:rgb(174,167,159); + border-width: 1px; + border-radius: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(200, 200, 200, 255), stop:1 rgba(230, 230, 230, 255)); +} +QRadioButton { + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: rgba(246, 134, 86, 255); + color: #a9b7c6; + background-color:rgba(246, 134, 86, 255); +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: rgb(246, 134, 86); + color: #a9b7c6; + background-color: transparent; +} +QScrollArea { + color: white; + background-color:#f0f0f0; +} +QSlider::groove { + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); +} +QSlider::groove:horizontal { + height: 5px; + background: rgb(246, 134, 86); +} +QSlider::groove:vertical { + width: 5px; + background: rgb(246, 134, 86); +} +QSlider::handle:horizontal { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + width: 12px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + height: 12px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal, QSlider::add-page:vertical { + background: white; +} +QSlider::sub-page:horizontal, QSlider::sub-page:vertical { + background: rgb(246, 134, 86); +} +QStatusBar, QSpinBox { + color:rgb(81,72,65); +} +QSpinBox { + background-color: #ffffff; +} +QScrollBar:horizontal { + max-height: 20px; + border: 1px transparent; + margin: 0px 20px 0px 20px; +} +QScrollBar::handle:horizontal { + background: rgb(253,253,253); + border: 1px solid rgb(207,207,207); + border-radius: 7px; + min-width: 25px; +} +QScrollBar::handle:horizontal:hover { + background: rgb(253,253,253); + border: 1px solid rgb(255,150,60); + border-radius: 7px; + min-width: 25px; +} +QScrollBar::add-line:horizontal { + border: 1px solid rgb(207,207,207); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-right-radius: 7px; + background: rgb(255, 255, 255); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:hover { + border: 1px solid rgb(255,150,60); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-right-radius: 7px; + background: rgb(255, 255, 255); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:pressed { + border: 1px solid grey; + border-top-left-radius: 7px; + border-top-right-radius: 7px; + border-bottom-right-radius: 7px; + background: rgb(231,231,231); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal { + border: 1px solid rgb(207,207,207); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(255, 255, 255); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:hover { + border: 1px solid rgb(255,150,60); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(255, 255, 255); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:pressed { + border: 1px solid grey; + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(231,231,231); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::left-arrow:horizontal { + border: 1px transparent grey; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; + width: 6px; + height: 6px; + background: rgb(230,230,230); +} +QScrollBar::right-arrow:horizontal { + border: 1px transparent grey; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; + width: 6px; + height: 6px; + background: rgb(230,230,230); +} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} +QScrollBar:vertical { + max-width: 20px; + border: 1px transparent grey; + margin: 20px 0px 20px 0px; +} +QScrollBar::add-line:vertical { + border: 1px solid; + border-color: rgb(207,207,207); + border-bottom-right-radius: 7px; + border-bottom-left-radius: 7px; + border-top-left-radius: 7px; + background: rgb(255, 255, 255); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:hover { + border: 1px solid; + border-color: rgb(255,150,60); + border-bottom-right-radius: 7px; + border-bottom-left-radius: 7px; + border-top-left-radius: 7px; + background: rgb(255, 255, 255); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:pressed { + border: 1px solid grey; + border-bottom-left-radius: 7px; + border-bottom-right-radius: 7px; + border-top-left-radius: 7px; + background: rgb(231,231,231); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical { + border: 1px solid rgb(207,207,207); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(255, 255, 255); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:hover { + border: 1px solid rgb(255,150,60); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(255, 255, 255); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:pressed { + border: 1px solid grey; + border-top-left-radius: 7px; + border-top-right-radius: 7px; + background: rgb(231,231,231); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::handle:vertical { + background: rgb(253,253,253); + border: 1px solid rgb(207,207,207); + border-radius: 7px; + min-height: 25px; +} +QScrollBar::handle:vertical:hover { + background: rgb(253,253,253); + border: 1px solid rgb(255,150,60); + border-radius: 7px; + min-height: 25px; +} +QScrollBar::up-arrow:vertical { + border: 1px transparent grey; + border-top-left-radius: 3px; + border-top-right-radius: 3px; + width: 6px; + height: 6px; + background: rgb(230,230,230); +} +QScrollBar::down-arrow:vertical { + border: 1px transparent grey; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + width: 6px; + height: 6px; + background: rgb(230,230,230); +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} +QTabWidget { + color:rgb(0,0,0); + background-color:rgb(247,246,246); +} +QTabWidget::pane { + border-color: rgb(180,180,180); + background-color:rgb(247,246,246); + border-style: solid; + border-width: 1px; + border-radius: 6px; +} +QTabBar::tab { + padding-left:4px; + padding-right:4px; + padding-bottom:2px; + padding-top:2px; + color:rgb(81,72,65); + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(221,218,217,255), stop:1 rgba(240,239,238,255)); + border-style: solid; + border-width: 1px; + border-top-right-radius:4px; + border-top-left-radius:4px; + border-top-color: rgb(180,180,180); + border-left-color: rgb(180,180,180); + border-right-color: rgb(180,180,180); + border-bottom-color: transparent; +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + background-color:rgb(247,246,246); + margin-left: 0px; + margin-right: 1px; +} +QTabBar::tab:!selected { + margin-top: 1px; + margin-right: 1px; +} +QTextEdit { + border-width: 1px; + border-style: solid; + border-color:transparent; + color:rgb(17,17,17); + selection-background-color:rgb(236,116,64); +} +QTimeEdit, QToolBox, QToolBox::tab, QToolBox::tab:selected { + color:rgb(81,72,65); + background-color: #ffffff; +} diff --git a/GF3StripPatchProcess/main.cpp b/GF3StripPatchProcess/main.cpp new file mode 100644 index 0000000..938a8a6 --- /dev/null +++ b/GF3StripPatchProcess/main.cpp @@ -0,0 +1,112 @@ +/** +* @file GF3StripPatchProcess/main.cpp +* @brief Main entry point for the GF3 Strip Patch Process application. +* @details GF3Ӱ +* @author (3045316072@qq.com) +* @date 2025-05-12 +* @version 1.0 +*/ +#include +#include "QGF3StripBatchProcessDialog.h" +#include +#include +#include +#include +#include + +#pragma execution_character_set("utf-8") + +// ԶϢ +void customMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg) +{ + QByteArray localMsg = msg.toLocal8Bit(); + const char* file = context.file ? context.file : ""; + const char* function = context.function ? context.function : ""; + QString dateTime = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz"); + + QFile outFile("application.log"); + outFile.open(QIODevice::WriteOnly | QIODevice::Append); + QTextStream ts(&outFile); + + switch (type) { + case QtDebugMsg: + { + QString logMessage = QString("%1 Debug: %2 (%3:%4, %5)") + .arg(dateTime) // Assuming dateTime is a QDateTime object and needs to be converted to string + .arg(QString::fromLocal8Bit(localMsg.constData())) + .arg(file) + .arg(context.line) + .arg(function); + ts << logMessage << "\n"; + std::cout << logMessage.toLocal8Bit().constData() << std::endl; + break; + } + case QtInfoMsg: + { + QString logMessage = QString("%1 Info: %2 (%3:%4, %5)") + .arg(dateTime) + .arg(QString::fromLocal8Bit(localMsg.constData())) + .arg(file) + .arg(context.line) + .arg(function); + ts << logMessage << "\n"; + std::cout << logMessage.toLocal8Bit().constData() << std::endl; + break; + } + case QtWarningMsg: + { + QString logMessage = QString("%1 Warning: %2 (%3:%4, %5)") + .arg(dateTime) + .arg(QString::fromLocal8Bit(localMsg.constData())) + .arg(file) + .arg(context.line) + .arg(function); + ts << logMessage << "\n"; + break; + } + case QtCriticalMsg: + { + QString logMessage = QString("%1 Critical: %2 (%3:%4, %5)") + .arg(dateTime) + .arg(QString::fromLocal8Bit(localMsg.constData())) + .arg(file) + .arg(context.line) + .arg(function); + ts << logMessage << "\n"; + std::cout << logMessage.toLocal8Bit().constData() << std::endl; + break; + } + case QtFatalMsg: + { + QString logMessage = QString("%1 Fatal: %2 (%3:%4, %5)") + .arg(dateTime) + .arg(QString::fromLocal8Bit(localMsg.constData())) + .arg(file) + .arg(context.line) + .arg(function); + ts << logMessage << "\n"; + std::cout << logMessage.toLocal8Bit().constData() << std::endl; + abort(); + } + + } +} + + +int main(int argc, char* argv[]) +{ + qInstallMessageHandler(customMessageHandler); + + QApplication a(argc, argv); + + QFile qssFile(u8"./QSS/AMOLED.qss"); + if (qssFile.open(QFile::ReadOnly)) { + a.setStyleSheet(qssFile.readAll()); + } + qssFile.close(); + + + + showQGF3StripBatchProcessDialog(nullptr); + return a.exec(); +} diff --git a/GF3StripPatchProcess/proj.db b/GF3StripPatchProcess/proj.db new file mode 100644 index 0000000..05c2119 Binary files /dev/null and b/GF3StripPatchProcess/proj.db differ diff --git a/LAMPDataProcess.sln b/LAMPDataProcess.sln index 0559e59..b829429 100644 --- a/LAMPDataProcess.sln +++ b/LAMPDataProcess.sln @@ -42,6 +42,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pluginToolboxLibrary", "plu EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPG4Tool", "SPG4Tool\SPG4Tool.vcxproj", "{80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KJ135WBJYAlgInterfaceToolbox", "Toolbox\KJ135WBJYAlgInterfaceToolbox\KJ135WBJYAlgInterfaceToolbox.vcxproj", "{D3E9A2CA-7F05-425A-A4B6-416EC20972E8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GF3StripPatchProcess", "GF3StripPatchProcess\GF3StripPatchProcess.vcxproj", "{6386D3E3-B743-419F-8354-DA48D0B08728}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GF3CalibrationAndOrthLib", "GF3CalibrationAndOrthLib\GF3CalibrationAndOrthLib.vcxproj", "{886F7829-AF74-4F23-B3BE-29B7B3C9843C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM = Debug|ARM @@ -196,6 +202,42 @@ Global {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x64.Build.0 = Release|x64 {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x86.ActiveCfg = Release|x64 {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E}.Release|x86.Build.0 = Release|x64 + {D3E9A2CA-7F05-425A-A4B6-416EC20972E8}.Debug|ARM.ActiveCfg = Debug|x64 + {D3E9A2CA-7F05-425A-A4B6-416EC20972E8}.Debug|ARM.Build.0 = Debug|x64 + {D3E9A2CA-7F05-425A-A4B6-416EC20972E8}.Debug|x64.ActiveCfg = Debug|x64 + {D3E9A2CA-7F05-425A-A4B6-416EC20972E8}.Debug|x64.Build.0 = Debug|x64 + {D3E9A2CA-7F05-425A-A4B6-416EC20972E8}.Debug|x86.ActiveCfg = Debug|x64 + {D3E9A2CA-7F05-425A-A4B6-416EC20972E8}.Debug|x86.Build.0 = Debug|x64 + {D3E9A2CA-7F05-425A-A4B6-416EC20972E8}.Release|ARM.ActiveCfg = Release|x64 + {D3E9A2CA-7F05-425A-A4B6-416EC20972E8}.Release|ARM.Build.0 = Release|x64 + {D3E9A2CA-7F05-425A-A4B6-416EC20972E8}.Release|x64.ActiveCfg = Release|x64 + {D3E9A2CA-7F05-425A-A4B6-416EC20972E8}.Release|x64.Build.0 = Release|x64 + {D3E9A2CA-7F05-425A-A4B6-416EC20972E8}.Release|x86.ActiveCfg = Release|x64 + {D3E9A2CA-7F05-425A-A4B6-416EC20972E8}.Release|x86.Build.0 = Release|x64 + {6386D3E3-B743-419F-8354-DA48D0B08728}.Debug|ARM.ActiveCfg = Debug|x64 + {6386D3E3-B743-419F-8354-DA48D0B08728}.Debug|ARM.Build.0 = Debug|x64 + {6386D3E3-B743-419F-8354-DA48D0B08728}.Debug|x64.ActiveCfg = Debug|x64 + {6386D3E3-B743-419F-8354-DA48D0B08728}.Debug|x64.Build.0 = Debug|x64 + {6386D3E3-B743-419F-8354-DA48D0B08728}.Debug|x86.ActiveCfg = Debug|x64 + {6386D3E3-B743-419F-8354-DA48D0B08728}.Debug|x86.Build.0 = Debug|x64 + {6386D3E3-B743-419F-8354-DA48D0B08728}.Release|ARM.ActiveCfg = Release|x64 + {6386D3E3-B743-419F-8354-DA48D0B08728}.Release|ARM.Build.0 = Release|x64 + {6386D3E3-B743-419F-8354-DA48D0B08728}.Release|x64.ActiveCfg = Release|x64 + {6386D3E3-B743-419F-8354-DA48D0B08728}.Release|x64.Build.0 = Release|x64 + {6386D3E3-B743-419F-8354-DA48D0B08728}.Release|x86.ActiveCfg = Release|x64 + {6386D3E3-B743-419F-8354-DA48D0B08728}.Release|x86.Build.0 = Release|x64 + {886F7829-AF74-4F23-B3BE-29B7B3C9843C}.Debug|ARM.ActiveCfg = Debug|x64 + {886F7829-AF74-4F23-B3BE-29B7B3C9843C}.Debug|ARM.Build.0 = Debug|x64 + {886F7829-AF74-4F23-B3BE-29B7B3C9843C}.Debug|x64.ActiveCfg = Debug|x64 + {886F7829-AF74-4F23-B3BE-29B7B3C9843C}.Debug|x64.Build.0 = Debug|x64 + {886F7829-AF74-4F23-B3BE-29B7B3C9843C}.Debug|x86.ActiveCfg = Debug|x64 + {886F7829-AF74-4F23-B3BE-29B7B3C9843C}.Debug|x86.Build.0 = Debug|x64 + {886F7829-AF74-4F23-B3BE-29B7B3C9843C}.Release|ARM.ActiveCfg = Release|x64 + {886F7829-AF74-4F23-B3BE-29B7B3C9843C}.Release|ARM.Build.0 = Release|x64 + {886F7829-AF74-4F23-B3BE-29B7B3C9843C}.Release|x64.ActiveCfg = Release|x64 + {886F7829-AF74-4F23-B3BE-29B7B3C9843C}.Release|x64.Build.0 = Release|x64 + {886F7829-AF74-4F23-B3BE-29B7B3C9843C}.Release|x86.ActiveCfg = Release|x64 + {886F7829-AF74-4F23-B3BE-29B7B3C9843C}.Release|x86.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -210,6 +252,8 @@ Global {E56B3878-A3DC-41A4-ABF3-B628816D0D64} = {6505E2BA-06A2-447B-BC85-8CF1A81359BC} {8C8CA066-A93A-4098-9A46-B855EFEAADF2} = {2768F9D6-D410-4E88-A479-8336DAF97072} {80A5854F-6F80-4EC2-9F73-84E0F4DB8D7E} = {2768F9D6-D410-4E88-A479-8336DAF97072} + {D3E9A2CA-7F05-425A-A4B6-416EC20972E8} = {41B1F23D-9119-47A7-B102-34022AF83CDA} + {886F7829-AF74-4F23-B3BE-29B7B3C9843C} = {2768F9D6-D410-4E88-A479-8336DAF97072} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {179F0A62-C631-4667-AD03-3780ADE09F41} diff --git a/LAMPDataProcessEXE/LAMPDataProcessEXE.vcxproj b/LAMPDataProcessEXE/LAMPDataProcessEXE.vcxproj index b979ef0..44e520b 100644 --- a/LAMPDataProcessEXE/LAMPDataProcessEXE.vcxproj +++ b/LAMPDataProcessEXE/LAMPDataProcessEXE.vcxproj @@ -196,9 +196,6 @@ {b8b40c54-f7fe-4809-b6fb-8bc014570d7b} - - {667625a5-8de2-4373-99f0-8bad2cced011} - {e56b3878-a3dc-41a4-abf3-b628816d0d64} diff --git a/LAMPDataProcessEXE/LAMPMainWidget.sqlite b/LAMPDataProcessEXE/LAMPMainWidget.sqlite deleted file mode 100644 index bea7b1d..0000000 Binary files a/LAMPDataProcessEXE/LAMPMainWidget.sqlite and /dev/null differ diff --git a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp index edf4a44..55a4491 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp +++ b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.cpp @@ -40,29 +40,17 @@ namespace LAMPMainWidget { mUi->setupUi(dynamic_cast(this)); setupWindow(); setupTaskWindow(); + setupShowMessage(); + + this->show();// 强制显示窗口 setupLayers(); setupStatusBar(); setupActions(); setRightToolbox(); - mUi->panAction->trigger(); mUi->layerList->setCurrentItem(mLayerList.first()); - this->show();// 强制显示窗口 - // 绑定消息显示 - RasterMessageShow::RasterWidgetMessageShow* messageshow = RasterMessageShow::RasterWidgetMessageShow::getInstance(this); - messageshow->bandingTextBrowserMessage(this->mUi->textBrowserMessage); - - connect(mUi->actioncloseAllRasterFile, SIGNAL(triggered()), this, SLOT(onactioncloseAllRasterFile_triggered())); - - this->mUi->toolBar->hide(); - this->mUi->dockWidget_Map->hide(); - this->mUi->dockWidget->hide(); - this->mUi->statusbar->hide(); - this->mUi->dockWidget_2->hide(); - this->mUi->dockWidget_3->hide(); - } RasterMainWidget::~RasterMainWidget() { @@ -74,8 +62,7 @@ namespace LAMPMainWidget { delete mCenterLabel; } - void - RasterMainWidget::setupTaskWindow() { + void RasterMainWidget::setupTaskWindow() { mUi->taskTable->setColumnCount(5); mUi->taskTable->setHorizontalHeaderLabels(QStringList{ "名称", "范围", "zoom值", "数据源", "进度" @@ -83,8 +70,7 @@ namespace LAMPMainWidget { mUi->taskTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); } - void - RasterMainWidget::setupActions() { + void RasterMainWidget::setupActions() { mMapActionGroup->addAction(mUi->panAction); mMapActionGroup->addAction(mUi->zoomInAction); mMapActionGroup->addAction(mUi->zoomOutAction); @@ -104,6 +90,9 @@ namespace LAMPMainWidget { } void RasterMainWidget::setupWindow() { + //mMapglWidget = new QOpenGLWidget(mMapConvas); // 使用OpenGL渲染 + //mMapConvas->setViewport(mMapglWidget); + //mMapConvas->setViewportUpdateMode(QGraphicsView::FullViewportUpdate); mUi->mapCanvasLayout->addWidget(mMapConvas); //setFixedSize(size()); //setWindowFlags(windowFlags() | Qt::WindowMinMaxButtonsHint | Qt::WindowSystemMenuHint); @@ -157,12 +146,11 @@ namespace LAMPMainWidget { } } - void - RasterMainWidget::initMaps() { - if (false&&mMaps.isEmpty()) { + void RasterMainWidget::initMaps() { + if (mMaps.isEmpty()) { mMaps = QHash{ - {"Openstreet地图", new TmsLayer(OSTNormalMap, "ostnormalmap", mMapConvas)}, - {"高德地图", new TmsLayer(GaodeNormapMap, "gaodenormalmap", mMapConvas)} + //{"Openstreet地图", new TmsLayer(OSTNormalMap, "ostnormalmap", mMapConvas)}, + {"高德地图", new TmsLayer(GaodeNormapMap, "gaodenormalmap", mMapConvas)} }; } } @@ -188,6 +176,16 @@ namespace LAMPMainWidget { } + void RasterMainWidget::setupShowMessage() + { + // 绑定消息显示 + RasterMessageShow::RasterWidgetMessageShow* messageshow = RasterMessageShow::RasterWidgetMessageShow::getInstance(this); + messageshow->bandingTextBrowserMessage(this->mUi->textBrowserMessage); + + connect(mUi->actioncloseAllRasterFile, SIGNAL(triggered()), this, SLOT(onactioncloseAllRasterFile_triggered())); + + } + QWidget* RasterMainWidget::spacerWiget(int width) const { auto spacer = new QWidget{}; spacer->setHidden(true); @@ -197,18 +195,15 @@ namespace LAMPMainWidget { return spacer; } - void - RasterMainWidget::panHandle(bool checked) { + void RasterMainWidget::panHandle(bool checked) { mMapConvas->selectTool(QString{ "pan_tool" }); } - void - RasterMainWidget::zoomInHandle(bool checked) { + void RasterMainWidget::zoomInHandle(bool checked) { mMapConvas->selectTool(QString{ "zoomin_tool" }); } - void - RasterMainWidget::zoomOutHandle(bool checked) { + void RasterMainWidget::zoomOutHandle(bool checked) { mMapConvas->selectTool(QString{ "zoomout_tool" }); } @@ -217,38 +212,32 @@ namespace LAMPMainWidget { mMapConvas->selectTool("drawline_tool"); } - - void - RasterMainWidget::sponsorHandle(bool checked) { + + void RasterMainWidget::sponsorHandle(bool checked) { auto* window = new SponsorWindow(dynamic_cast(this)); window->exec(); window->deleteLater(); } - void - RasterMainWidget::refreshHandle(bool checked) { + void RasterMainWidget::refreshHandle(bool checked) { mMapConvas->refreshMap(); } - void - RasterMainWidget::selectHandle(bool checked) { + void RasterMainWidget::selectHandle(bool checked) { mMapConvas->selectTool(QString{ "select_tool" }); } - void - RasterMainWidget::centerChangedHandle(LAMPMainWidget::PointXY pos) { + void RasterMainWidget::centerChangedHandle(LAMPMainWidget::PointXY pos) { mCenterText->setText(QString("lon:%1, lat:%2").arg(pos.x()).arg(pos.y())); } - void - RasterMainWidget::zoomChangedHandle(int zoom) { + void RasterMainWidget::zoomChangedHandle(int zoom) { mZoomText->setText(QString("%1").arg(zoom)); mScaleText->setText(QString("1cm:%1m").arg(this->mMapConvas->scale())); } - void - RasterMainWidget::clickedHandle(LAMPMainWidget::PointXY pos) { + void RasterMainWidget::clickedHandle(LAMPMainWidget::PointXY pos) { QString posText = QString("%1, %2").arg(pos.x()).arg(pos.y()); if (mSetLeftTop) { mUi->leftTopText->setText(posText); @@ -260,23 +249,20 @@ namespace LAMPMainWidget { } } - void - RasterMainWidget::leftTopClickedHandle() { + void RasterMainWidget::leftTopClickedHandle() { mSetLeftTop = true; mUi->selectAction->trigger(); } - void - RasterMainWidget::rightBottomClickedHandle() { + void RasterMainWidget::rightBottomClickedHandle() { mSetLeftTop = false; mUi->selectAction->trigger(); } - void - RasterMainWidget::layerChanged(QListWidgetItem* current, QListWidgetItem* previous) { + void RasterMainWidget::layerChanged(QListWidgetItem* current, QListWidgetItem* previous) { auto mapName = current->text(); if (!mMaps.contains(mapName)) { - qDebug() << mapName << "不支持"; + qDebug() << mapName << u8"不支持"; return; } @@ -284,7 +270,7 @@ namespace LAMPMainWidget { auto i = mMaps.begin(); for (; i != mMaps.end(); ++i) { if (i.key() == mapName) { - i.value()->setVisiblity(true); + i.value()->setVisiblity(true); // 切换图层为显示模式 qDebug() << i.key() << i.value()->isVisible(); continue; } @@ -292,23 +278,21 @@ namespace LAMPMainWidget { i.value()->setVisiblity(false); } - mMapConvas->addLayer(layer); + mMapConvas->addLayer(layer);//图层开始显示 mMapConvas->setCurrentLayer(layer->id()); - mMapConvas->refreshMap(); + mMapConvas->refreshMap();//刷新地图 - zoomChangedHandle(mMapConvas->zoomValue()); - centerChangedHandle(mMapConvas->mapCenter()); + zoomChangedHandle(mMapConvas->zoomValue());// 更新zoom值 + centerChangedHandle(mMapConvas->mapCenter());// 更新中心坐标 } - void - RasterMainWidget::createDownloadTask() { + void RasterMainWidget::createDownloadTask() { auto taskWindow = new TaskWindow(dynamic_cast(this)); taskWindow->exec(); taskWindow->deleteLater(); } - void - RasterMainWidget::changeTaskTable(int row, int col, QString text) { + void RasterMainWidget::changeTaskTable(int row, int col, QString text) { mUi->taskTable->takeItem(row, col); mUi->taskTable->setItem(row, col, new QTableWidgetItem(text)); } @@ -325,14 +309,14 @@ namespace LAMPMainWidget { mMapConvas->selectTool("addplane_tool"); } -void RasterMainWidget::onactioncloseAllRasterFile_triggered() -{ - CloseAllGDALRaster(); -} + void RasterMainWidget::onactioncloseAllRasterFile_triggered() + { + CloseAllGDALRaster(); + } -QTableWidget* RasterMainWidget::getTaskTable() -{ - return this->mUi->taskTable; -} + QTableWidget* RasterMainWidget::getTaskTable() + { + return this->mUi->taskTable; + } } diff --git a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h index 0ece4a1..b496804 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h +++ b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -44,7 +45,7 @@ namespace LAMPMainWidget { void initMaps(); void setRightToolbox(); void initToolbox(); - + void setupShowMessage(); protected: /// 各处处理函数 @@ -75,7 +76,10 @@ namespace LAMPMainWidget { void onactioncloseAllRasterFile_triggered(); private: Ui::RasterMainWidget* mUi; - MapCanvas* mMapConvas; + MapCanvas* mMapConvas;//地图容器 + QOpenGLWidget* mMapglWidget;// OpenGL窗口 + + QLineEdit* mScaleText; QLabel* mScaleLabel; QLineEdit* mCenterText; diff --git a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui index bfcfbae..268db3e 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui +++ b/RasterMainWidgetGUI/RasterMainWidget/RasterMainWidget.ui @@ -12,8 +12,8 @@ 0 0 - 898 - 580 + 906 + 609 @@ -84,8 +84,8 @@ 0 0 - 898 - 22 + 906 + 23 @@ -117,11 +117,15 @@ 工具 + + 帮助 + + @@ -134,9 +138,6 @@ - - false - toolBar @@ -378,85 +379,11 @@ p, li { white-space: pre-wrap; } - - - Qt::LeftToRight - - - 地图窗口 - - - 1 - - - - - - 10 - 0 - 502 - 274 - - - - - 0 - 0 - - - - 0 - - - - 地图 - - - - - - - - - - 任务 - - - - - 0 - 0 - 1431 - 871 - - - - - - - - - - - - - - - - 0 - 0 - 906 - 23 - - - - - 工具 + + + 释放影像文件 - - - - + 使用教程 @@ -593,11 +520,6 @@ p, li { white-space: pre-wrap; } 飞机 - - - 释放影像文件 - - diff --git a/RasterMainWidgetGUI/RasterMainWidget/gaodenormalprovider.cpp b/RasterMainWidgetGUI/RasterMainWidget/gaodenormalprovider.cpp index 116e44b..511841f 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/gaodenormalprovider.cpp +++ b/RasterMainWidgetGUI/RasterMainWidget/gaodenormalprovider.cpp @@ -9,8 +9,7 @@ namespace LAMPMainWidget { initCache(); } - QString - GaodeNormalProvider::tileUrl(const LAMPMainWidget::PointXY& pos, int zoom) const { + QString GaodeNormalProvider::tileUrl(const LAMPMainWidget::PointXY& pos, int zoom) const { QString urlFmt = { R"(http://wprd01.is.autonavi.com/appmaptile?style=6&x=%1&y=%2&z=%3)" }; return QString(urlFmt).arg(pos.x()).arg(pos.y()).arg(zoom); diff --git a/RasterMainWidgetGUI/RasterMainWidget/mapcanvas.cpp b/RasterMainWidgetGUI/RasterMainWidget/mapcanvas.cpp index 498be61..7fdc53b 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/mapcanvas.cpp +++ b/RasterMainWidgetGUI/RasterMainWidget/mapcanvas.cpp @@ -84,8 +84,7 @@ namespace LAMPMainWidget { setZoomValue(zoom); } - void - MapCanvas::resizeEvent(QResizeEvent* event) { + void MapCanvas::resizeEvent(QResizeEvent* event) { updateViewExtent(true); } @@ -97,19 +96,17 @@ namespace LAMPMainWidget { QGraphicsView::mouseMoveEvent(event); } - void - MapCanvas::refreshMap() { + void MapCanvas::refreshMap() { QMapIterator iterator(mLayers); while (iterator.hasNext()) { iterator.next(); - iterator.value()->map()->setViewExtent(mViewExtent); - iterator.value()->update(); + iterator.value()->map()->setViewExtent(mViewExtent);//设置当前图层的可视范围 + iterator.value()->update();//更新当前图层的显示内容 } mScene->update(); } - void - MapCanvas::addLayer(MapLayer* const layer) { + void MapCanvas::addLayer(MapLayer* const layer) { if (!layer) return; @@ -119,15 +116,14 @@ namespace LAMPMainWidget { } mLayers.insert(layer->id(), layer); - if (mLayers.count() == 1) { + if (mLayers.count() == 1) {//判断是否是第唯一个图层 setCurrentLayer(layer->id()); } - mScene->addItem(layer->map()); + mScene->addItem(layer->map());//将当前图层添加到场景中 refreshMap(); } - void - MapCanvas::setZoomValue(const int zoom) { + void MapCanvas::setZoomValue(const int zoom) { mZoomValue = normalizeZoom(zoom); zoomChanged(mZoomValue); @@ -142,8 +138,7 @@ namespace LAMPMainWidget { updateViewExtent(true); } - void - MapCanvas::updateViewExtent(bool reset) { + void MapCanvas::updateViewExtent(bool reset) { if (!mCurrentLayer) { qDebug() << "未设置当前图层,视图区域无法更新"; return; @@ -161,7 +156,7 @@ namespace LAMPMainWidget { mViewExtent.translate(offset.x(), offset.y()); } else { - qDebug() << "视图区域更新 平移范围 x ,y "<<-mDragRect.width()<<" , "<<-mDragRect.height() ; + qDebug() << "视图区域更新 平移范围 x ,y " << -mDragRect.width() << " , " << -mDragRect.height(); /// 视图偏移并重置偏移属性 mViewExtent.translate(-mDragRect.width(), -mDragRect.height()); mDragRect.setRect(0, 0, 0, 0); @@ -178,33 +173,29 @@ namespace LAMPMainWidget { refreshMap(); } - void - MapCanvas::setCrs(const CRS* const crs) { + void MapCanvas::setCrs(const CRS* const crs) { mCrs = crs; crsChanged(); updateViewExtent(true); } - void - MapCanvas::setCurrentLayer(const QString& id) { + void MapCanvas::setCurrentLayer(const QString& id) { if (!mLayers.contains(id)) { qWarning() << "未添加图层=>" << id; return; } mCurrentLayer = mLayers[id]; if (!mCrs) { - setCrs(&mCurrentLayer->crs()); + setCrs(&mCurrentLayer->crs());//设置当前图层的坐标系,后期考虑继续拆分 } - updateViewExtent(true); + updateViewExtent(true);// 更新视图区域 } - double - MapCanvas::scale() const { + double MapCanvas::scale() const { return logicalDpiX() * resolution() * 39.37 / 100;; } - double - MapCanvas::resolution() const { + double MapCanvas::resolution() const { if (!mCurrentLayer) { qWarning() << "未设置当前图层,无法获取分辨率"; return 0; @@ -213,8 +204,7 @@ namespace LAMPMainWidget { return mCurrentLayer->resolution(); } - int - MapCanvas::zoomValue() const { + int MapCanvas::zoomValue() const { if (!mCurrentLayer) { qWarning() << "未设置当前图层,默认返回zoom值为0"; return 0; @@ -223,8 +213,7 @@ namespace LAMPMainWidget { return mCurrentLayer->zoomValue(); } - int - MapCanvas::normalizeZoom(const int zoom) const { + int MapCanvas::normalizeZoom(const int zoom) const { int z{}; if (zoom <= kMinZoomValue) { z = kMinZoomValue; @@ -239,8 +228,7 @@ namespace LAMPMainWidget { return z; } - PointXY - MapCanvas::pixel2Lonlat(const QPointF& point) const { + PointXY MapCanvas::pixel2Lonlat(const QPointF& point) const { QPointF scenePoint = mapToScene(QPoint{ static_cast(point.x()), static_cast(point.y()) }); QPointF mapPoint{ scenePoint.x() * resolution(), scenePoint.y() * resolution() }; PointXY crsPoint = mCrs->inverse(PointXY{ mapPoint }); @@ -248,8 +236,7 @@ namespace LAMPMainWidget { return crsPoint; } - bool - MapCanvas::selectTool(const QString& tool) { + bool MapCanvas::selectTool(const QString& tool) { if (!mMapTools.contains(tool)) { qWarning() << QString("%1工具不存在").arg(tool); return false; @@ -274,8 +261,7 @@ namespace LAMPMainWidget { } } - void - MapCanvas::setupTools() { + void MapCanvas::setupTools() { auto panTool = new MapToolPan(this); mMapTools.insert(panTool->id(), panTool); diff --git a/RasterMainWidgetGUI/RasterMainWidget/mapcanvas.h b/RasterMainWidgetGUI/RasterMainWidget/mapcanvas.h index dd4e580..31f6753 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/mapcanvas.h +++ b/RasterMainWidgetGUI/RasterMainWidget/mapcanvas.h @@ -162,7 +162,7 @@ namespace LAMPMainWidget { void mouseMoveEvent(QMouseEvent* event) override; protected: - QGraphicsScene* mScene; + QGraphicsScene* mScene; // 场景对象 QRectF mMapExtent; QRectF mViewExtent; QRectF mDragRect; diff --git a/RasterMainWidgetGUI/RasterMainWidget/mapcanvasmap.cpp b/RasterMainWidgetGUI/RasterMainWidget/mapcanvasmap.cpp index a55bc79..06c4098 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/mapcanvasmap.cpp +++ b/RasterMainWidgetGUI/RasterMainWidget/mapcanvasmap.cpp @@ -10,16 +10,20 @@ namespace LAMPMainWidget { - void - MapCanvasMap::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { + /// + /// 重写paint函数,绘制图层的内容 + /// + /// + /// + /// + void MapCanvasMap::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { if (!mLayer->provider().hasContent()) { return; } painter->drawImage(mViewExtent.topLeft(), mLayer->provider().preparedImage()); } - QRectF - MapCanvasMap::boundingRect() const { + QRectF MapCanvasMap::boundingRect() const { auto width = mViewExtent.size().width(); auto height = mViewExtent.size().height(); return mViewExtent + QMarginsF(1024, 1024, 1024, 1024); diff --git a/RasterMainWidgetGUI/RasterMainWidget/mapcanvasmap.h b/RasterMainWidgetGUI/RasterMainWidget/mapcanvasmap.h index 3584ad1..cb54c25 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/mapcanvasmap.h +++ b/RasterMainWidgetGUI/RasterMainWidget/mapcanvasmap.h @@ -16,7 +16,7 @@ class MapCanvasMap : public QGraphicsItem { ~MapCanvasMap() override = default; public: - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; //图层绘制函数 QRectF boundingRect() const override; diff --git a/RasterMainWidgetGUI/RasterMainWidget/network.cpp b/RasterMainWidgetGUI/RasterMainWidget/network.cpp index f4586e4..f25e620 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/network.cpp +++ b/RasterMainWidgetGUI/RasterMainWidget/network.cpp @@ -5,81 +5,78 @@ namespace LAMPMainWidget { -size_t -writeData(void *content, size_t size, size_t nmemb, void *userp) { - size_t realSize{size * nmemb}; - auto userRes = static_cast(userp); - if (!userRes) { - qDebug() << "无效的数据存储对象"; - return 0; - } - userRes->append(static_cast(content), int(realSize)); + size_t writeData(void* content, size_t size, size_t nmemb, void* userp) { + size_t realSize{ size * nmemb }; + auto userRes = static_cast(userp); + if (!userRes) { + qDebug() << "无效的数据存储对象"; + return 0; + } + userRes->append(static_cast(content), int(realSize)); - return realSize; -} + return realSize; + } -const QString Network::kUserAgent{"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0"}; + const QString Network::kUserAgent{ "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" }; -QByteArray -Network::httpRequest(const QString &url) { - QByteArray result{}; - if (url.isEmpty()) { - qDebug() << QString("url为空"); - return result; - } + QByteArray Network::httpRequest(const QString& url) { + QByteArray result{}; + if (url.isEmpty()) { + qDebug() << QString("url为空"); + return result; + } - CURL *curl = curl_easy_init(); - if (!curl) { - qDebug() << "无法初始化curl句柄"; - return result; - } + CURL* curl = curl_easy_init(); + if (!curl) { + qDebug() << "无法初始化curl句柄"; + return result; + } - curl_easy_setopt(curl, CURLOPT_URL, url.toStdString().c_str()); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeData); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &result); - curl_easy_setopt(curl, CURLOPT_USERAGENT, kUserAgent.toStdString().c_str()); + curl_easy_setopt(curl, CURLOPT_URL, url.toStdString().c_str()); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeData); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &result); + curl_easy_setopt(curl, CURLOPT_USERAGENT, kUserAgent.toStdString().c_str()); - CURLcode res = curl_easy_perform(curl); - if (CURLE_OK != res) { - qDebug() << QString("%1 =>请求异常, %2").arg(url).arg(curl_easy_strerror(res)); - result.clear(); // 请求失败时,清空接受到的数据 - } + CURLcode res = curl_easy_perform(curl); + if (CURLE_OK != res) { + qDebug() << QString("%1 =>请求异常, %2").arg(url).arg(curl_easy_strerror(res)); + result.clear(); // 请求失败时,清空接受到的数据 + } - curl_easy_cleanup(curl); + curl_easy_cleanup(curl); - return result; -} + return result; + } -QByteArray -Network::httpsRequest(const QString &url) { - QByteArray result{}; - if (url.isEmpty()) { - qDebug() << QString("url为空"); - return result; - } + QByteArray Network::httpsRequest(const QString& url) { + QByteArray result{}; + if (url.isEmpty()) { + qDebug() << QString(u8"url为空"); + return result; + } - CURL *curl = curl_easy_init(); - if (!curl) { - qDebug() << "无法初始化curl句柄"; - return result; - } + CURL* curl = curl_easy_init(); + if (!curl) { + qDebug() << u8"无法初始化curl句柄"; + return result; + } - curl_easy_setopt(curl, CURLOPT_URL, url.toStdString().c_str()); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeData); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &result); - curl_easy_setopt(curl, CURLOPT_USERAGENT, kUserAgent.toStdString().c_str()); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); + curl_easy_setopt(curl, CURLOPT_URL, url.toStdString().c_str()); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeData); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &result); + curl_easy_setopt(curl, CURLOPT_USERAGENT, kUserAgent.toStdString().c_str()); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); - CURLcode res = curl_easy_perform(curl); - if (CURLE_OK != res) { - qDebug() << QString("%1 =>请求异常, %2").arg(url).arg(curl_easy_strerror(res)); - result.clear(); // 请求失败时,清空接受到的数据 - } + CURLcode res = curl_easy_perform(curl); + if (CURLE_OK != res) { + qDebug() << QString(u8"%1 =>请求异常, %2").arg(url).arg(curl_easy_strerror(res)); + result.clear(); // 请求失败时,清空接受到的数据 + } - curl_easy_cleanup(curl); + curl_easy_cleanup(curl); - return result; -} + return result; + } } diff --git a/RasterMainWidgetGUI/RasterMainWidget/taskwindow.cpp b/RasterMainWidgetGUI/RasterMainWidget/taskwindow.cpp index 03c6798..54e44f0 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/taskwindow.cpp +++ b/RasterMainWidgetGUI/RasterMainWidget/taskwindow.cpp @@ -17,8 +17,7 @@ namespace LAMPMainWidget { - void - DownloadTask::run() + void DownloadTask::run() { auto currentLayer = dynamic_cast(mTaskInfo.layer); auto provider = dynamic_cast(¤tLayer->provider()); @@ -53,14 +52,13 @@ namespace LAMPMainWidget double progress = static_cast(completed) / count; auto progessStr = QString("%1").arg(progress * 100); mTaskInfo.display->takeItem(mRowId, 4); - mTaskInfo.display->setItem(mRowId, 4,new QTableWidgetItem(QString("%1").arg(progress * 100))); + mTaskInfo.display->setItem(mRowId, 4, new QTableWidgetItem(QString("%1").arg(progress * 100))); // mTaskInfo.display->resizeColumnsToContents(); // mTaskInfo.display->horizontalHeader()->setStretchLastSection(true); } } - void - DownloadTask::generateCommonRow() + void DownloadTask::generateCommonRow() { auto provider = dynamic_cast(&mTaskInfo.layer->provider()); mRowId = mTaskInfo.display->rowCount(); @@ -71,24 +69,21 @@ namespace LAMPMainWidget mTaskInfo.display->setItem(mRowId, 3, new QTableWidgetItem(provider->id())); } - void - DownloadTask::generateErrorRow() + void DownloadTask::generateErrorRow() { generateCommonRow(); mTaskInfo.display->setItem(mRowId, 4, new QTableWidgetItem("任务新建失败")); mTaskInfo.display->resizeColumnsToContents(); } - void - DownloadTask::generateSuccessRow() + void DownloadTask::generateSuccessRow() { generateCommonRow(); mTaskInfo.display->setItem(mRowId, 4, new QTableWidgetItem("0.0%")); mTaskInfo.display->resizeColumnsToContents(); } - QString - DownloadTask::getExtentStr() + QString DownloadTask::getExtentStr() { auto leftTop = mTaskInfo.extent.topLeft(); auto rightBottom = mTaskInfo.extent.bottomRight(); @@ -112,8 +107,7 @@ namespace LAMPMainWidget delete mUi; } - void - TaskWindow::setupWindow() + void TaskWindow::setupWindow() { setFixedSize(size()); auto currentLayer = dynamic_cast(mParent->mMapConvas->currentLayer()); @@ -129,8 +123,7 @@ namespace LAMPMainWidget QString("%1, %2").arg(mParent->mRightBottom.x()).arg(mParent->mRightBottom.y())); } - void - TaskWindow::setupAction() + void TaskWindow::setupAction() { QObject::connect(mUi->exitBtn, &QPushButton::clicked, this, &TaskWindow::close); QObject::connect(mUi->createBtn, &QPushButton::clicked, this, &TaskWindow::createTask); @@ -140,8 +133,7 @@ namespace LAMPMainWidget this, &TaskWindow::setupZoomValue); } - void - TaskWindow::createTask() + void TaskWindow::createTask() { if (!taskInfoCheck()) { return; @@ -152,9 +144,9 @@ namespace LAMPMainWidget auto extent = QRectF(QPointF(mParent->mLeftTop.x(), mParent->mLeftTop.y()), QPointF(mParent->mRightBottom.x(), mParent->mRightBottom.y())); auto tileInfo = TaskInfo{ mTaskName, savePath, extent, - mZoomValue, - mParent->mMapConvas->currentLayer(), - mParent->getTaskTable() + mZoomValue, + mParent->mMapConvas->currentLayer(), + mParent->getTaskTable() /*mParent->mUi->taskTable*/ }; auto task = new DownloadTask(tileInfo); @@ -162,12 +154,11 @@ namespace LAMPMainWidget close(); } - void - TaskWindow::setupSaveDir() + void TaskWindow::setupSaveDir() { auto saveDir = QFileDialog::getExistingDirectory(dynamic_cast(this), "存储路径选择"); if (saveDir.isEmpty()) { - qWarning() << "未选择存储路径"; + qWarning() << u8"未选择存储路径"; return; } @@ -175,15 +166,13 @@ namespace LAMPMainWidget mUi->saveDirText->setText(mSavePath); } - void - TaskWindow::setupTaskName(const QString& text) + void TaskWindow::setupTaskName(const QString& text) { - qDebug() << "任务名=>" << text; + qWarning() << u8"任务名=>" << text; mTaskName = text; } - bool - TaskWindow::taskInfoCheck() + bool TaskWindow::taskInfoCheck() { if (mTaskName.isEmpty()) { QMessageBox::critical(dynamic_cast(this), "错误", "任务名称为空"); @@ -198,11 +187,10 @@ namespace LAMPMainWidget return true; } - void - TaskWindow::setupZoomValue(int index) + void TaskWindow::setupZoomValue(int index) { auto zoom = mUi->zoomValueCbx->itemData(index).toInt(); - qDebug() << "设置下载任务zoom值=>" << zoom; + qWarning() << u8"设置下载任务zoom值=>" << zoom; mZoomValue = zoom; } } diff --git a/RasterMainWidgetGUI/RasterMainWidget/tmslayer.cpp b/RasterMainWidgetGUI/RasterMainWidget/tmslayer.cpp index 1c45cba..ef74754 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/tmslayer.cpp +++ b/RasterMainWidgetGUI/RasterMainWidget/tmslayer.cpp @@ -18,8 +18,7 @@ namespace LAMPMainWidget { setProvider(TmsProviderFactory::create(provider)); } - double - TmsLayer::resolution() const { + double TmsLayer::resolution() const { auto pd = dynamic_cast(&provider()); auto sz = pd->tileSize(); double length = crs().extent().width(); @@ -32,8 +31,7 @@ namespace LAMPMainWidget { return result; } - QRectF - TmsLayer::extent() const { + QRectF TmsLayer::extent() const { auto pd = dynamic_cast(&provider()); QSize sz = pd->tileSize(); @@ -41,14 +39,13 @@ namespace LAMPMainWidget { int height = power2(zoomValue()) * sz.height(); //#ifdef DEBUG - // qDebug() << "layer extent=>{width:" << width << ", height:" << height << "}"; + qDebug() << "layer extent=>{width:" << width << ", height:" << height << "}"; //#endif return { 0, 0, static_cast(width), static_cast(height) }; } - void - TmsLayer::setZoomValue(int zoom) { + void TmsLayer::setZoomValue(int zoom) { int zoomValue{}; if (zoom <= minZoom()) { zoomValue = minZoom(); @@ -63,8 +60,7 @@ namespace LAMPMainWidget { mZoomValue = zoomValue; } - bool - TmsLayer::parseTiles(const QRectF& rect, int zoom, QHash& tiles, QSize& size) const { + bool TmsLayer::parseTiles(const QRectF& rect, int zoom, QHash& tiles, QSize& size) const { auto pd = dynamic_cast(&provider()); auto tileSize = pd->tileSize(); @@ -80,7 +76,7 @@ namespace LAMPMainWidget { auto yMin = qFloor(mapLeftTop.y() / tileSize.height()); auto yMax = qFloor(mapRightBottom.y() / tileSize.height()); if ((xMin > xMax) || (yMin > yMax)) { - qDebug() << "下载区边界错误"; + qDebug() << u8"下载区边界错误"; return false; } diff --git a/RasterMainWidgetGUI/RasterMainWidget/tmsprovider.cpp b/RasterMainWidgetGUI/RasterMainWidget/tmsprovider.cpp index 26c317f..d915178 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/tmsprovider.cpp +++ b/RasterMainWidgetGUI/RasterMainWidget/tmsprovider.cpp @@ -4,26 +4,32 @@ #include #include #include - +#include #include #include +#include #pragma execution_character_set("utf-8") namespace LAMPMainWidget { - TileDownloadTask::TileDownloadTask(TileInfo tile, QObject* parent) + TileDownloadTask::TileDownloadTask(TileInfo tile, tileReadyCallback cb, QObject* parent) : QObject(parent), - mTile(std::move(tile)) + mTile(std::move(tile)), + mCallback(cb) { + // 程序初始化时注册(如main函数或类构造函数) + qRegisterMetaType("TileInfo"); } - void - TileDownloadTask::run() + void TileDownloadTask::run() { Network web{}; QByteArray data = web.httpsRequest(mTile.url); mTile.data = data; - tileReady(mTile); + if (mCallback) { + mCallback(mTile); + } + else {} } TmsProvider::TmsProvider(QObject* parent) @@ -42,13 +48,12 @@ namespace LAMPMainWidget delete mImage; } - bool - TmsProvider::initCache() + bool TmsProvider::initCache() { mDbConn = QSqlDatabase::addDatabase("QSQLITE", id()); mDbConn.setDatabaseName(mDbName); if (!mDbConn.open()) { - qCritical() << "缓存数据库打开失败"; + std::cout << u8"缓存数据库打开失败"; return false; } @@ -71,8 +76,7 @@ namespace LAMPMainWidget return true; } - QByteArray - TmsProvider::getCache(const QPoint& pos, int zoom) + QByteArray TmsProvider::getCache(const QPoint& pos, int zoom) { QByteArray res{}; mDbConn.open(); @@ -87,7 +91,7 @@ namespace LAMPMainWidget select.bindValue(":zoom", zoom); select.bindValue(":position", QString("%1:%2").arg(pos.x()).arg(pos.y())); if (!select.exec()) { - qDebug() << pos << "查询失败=>" << select.lastError().text(); + std::cout << pos.x()<<","<" << select.lastError().text().toUtf8().constData() << std::endl; mDbConn.close(); return res; } @@ -101,11 +105,10 @@ namespace LAMPMainWidget return res; } - bool - TmsProvider::addCache(const QPoint& pos, int zoom, QByteArray data) + bool TmsProvider::addCache(const QPoint& pos, int zoom, QByteArray data) { if (data.isEmpty()) { - qWarning() << "瓦片数据为空"; + std::cout << "瓦片数据为空"; return false; } mDbConn.open(); @@ -121,7 +124,7 @@ namespace LAMPMainWidget sql.bindValue(":data", data); if (!sql.exec()) { - qCritical() << pos << "=>" << sql.lastError().text(); + std::cout << pos.x() << "," << pos.y() << "=>" << sql.lastError().text().toUtf8().constData() << std::endl; mDbConn.close(); return false; } @@ -130,15 +133,13 @@ namespace LAMPMainWidget return true; } - bool - TmsProvider::cacheContains(const QPoint& pos, int zoom) + bool TmsProvider::cacheContains(const QPoint& pos, int zoom) { QByteArray res = getCache(pos, zoom); return !res.isEmpty(); } - void - TmsProvider::createTask(const QRectF& rect, int zoom) + void TmsProvider::createTask(const QRectF& rect, int zoom) { newImage(rect); @@ -164,16 +165,30 @@ namespace LAMPMainWidget tileReady(tile); continue; } - + /* 原始写法遇到了跨线程信号槽失效问题,这里修改为回调函数方式 auto* task = new TileDownloadTask(tile); - QObject::connect(task, &TileDownloadTask::tileReady, this, &TmsProvider::tileReady); + if (!QObject::connect(task, SIGNAL(tileReady(TileInfo)), this, SLOT(tileReady(TileInfo)))) { + qDebug() << "连接失败:" << QObject::tr(qPrintable(Q_FUNC_INFO)); + } + QThreadPool::globalInstance()->start(task); + */ + // 回调函数版本 + QPointer safeThis(this); + auto* task = new TileDownloadTask(tile, [safeThis]( TileInfo info) { + if (safeThis) { // 自动检测对象是否存活 + QMetaObject::invokeMethod(safeThis.data(), [safeThis, info] { + safeThis->tileReady(info); + }, Qt::QueuedConnection); // 强制主线程执行[6](@ref) + } + }); + QThreadPool::globalInstance()->start(task); + } } } - void - TmsProvider::tileReady(TileInfo tile) + void TmsProvider::tileReady(TileInfo tile) { if (!cacheContains(tile.position, tile.zoom)) { addCache(tile.position, tile.zoom, tile.data); @@ -190,8 +205,7 @@ namespace LAMPMainWidget painter.drawImage(QPointF(xPos, yPos), img); } - void - TmsProvider::newImage(const QRectF& rect) + void TmsProvider::newImage(const QRectF& rect) { QSize imgSize{ int(rect.width()), int(rect.height()) }; if (!mImage || imgSize != mImage->size()) { diff --git a/RasterMainWidgetGUI/RasterMainWidget/tmsprovider.h b/RasterMainWidgetGUI/RasterMainWidget/tmsprovider.h index 2687cb3..bbffbda 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/tmsprovider.h +++ b/RasterMainWidgetGUI/RasterMainWidget/tmsprovider.h @@ -27,7 +27,8 @@ namespace LAMPMainWidget QString url; QByteArray data; }; - + // 在结构体定义后声明 + Q_DECLARE_METATYPE(TileInfo); /* * 异步执行的瓦片下载任务 */ @@ -39,7 +40,9 @@ namespace LAMPMainWidget void tileReady(TileInfo tile); public: - explicit TileDownloadTask(TileInfo tile, QObject* parent = nullptr); + using tileReadyCallback = std::function; + + explicit TileDownloadTask(TileInfo tile, tileReadyCallback=nullptr, QObject* parent = nullptr); TileDownloadTask(const TileDownloadTask& other) = delete; TileDownloadTask(TileDownloadTask&& other) = delete; TileDownloadTask& operator=(const TileDownloadTask& other) = delete; @@ -47,11 +50,15 @@ namespace LAMPMainWidget ~TileDownloadTask() override = default; + + public: void run() override; protected: TileInfo mTile; + private: + tileReadyCallback mCallback; }; class TmsProvider : public LayerProvider diff --git a/RasterMainWidgetGUI/RasterMainWidget/webmercator.cpp b/RasterMainWidgetGUI/RasterMainWidget/webmercator.cpp index d40cad2..94ebcb8 100644 --- a/RasterMainWidgetGUI/RasterMainWidget/webmercator.cpp +++ b/RasterMainWidgetGUI/RasterMainWidget/webmercator.cpp @@ -4,8 +4,7 @@ namespace LAMPMainWidget { - PointXY - WebMercator::forward(const LAMPMainWidget::PointXY& point) const + PointXY WebMercator::forward(const LAMPMainWidget::PointXY& point) const { PointXY result{}; PointXY originXy = CRS::forward(point); @@ -17,8 +16,7 @@ namespace LAMPMainWidget return result; } - PointXY - WebMercator::inverse(const LAMPMainWidget::PointXY& point) const + PointXY WebMercator::inverse(const LAMPMainWidget::PointXY& point) const { PointXY originXy{}; QSizeF sz = extent().size(); @@ -29,14 +27,12 @@ namespace LAMPMainWidget return CRS::inverse(originXy); } - QString - WebMercator::proj4Cvt() const + QString WebMercator::proj4Cvt() const { return QString{"+proj=webmerc +datum=WGS84"}; } - QString - WebMercator::wktDef() const + QString WebMercator::wktDef() const { return QString{ R"( diff --git a/RasterMainWidgetGUI/RasterMainWidgetGUI.vcxproj.filters b/RasterMainWidgetGUI/RasterMainWidgetGUI.vcxproj.filters index aeaec0b..69d2371 100644 --- a/RasterMainWidgetGUI/RasterMainWidgetGUI.vcxproj.filters +++ b/RasterMainWidgetGUI/RasterMainWidgetGUI.vcxproj.filters @@ -24,6 +24,12 @@ {1a65f538-c16c-4824-895f-105eb2fc502e} + + {7c9ae80d-da53-409c-805d-a3cc2c821574} + + + {bce9c1c4-57d0-42e5-bd9e-681fe17e9f00} + @@ -37,9 +43,6 @@ Source Files - - Source Files - Source Files @@ -91,9 +94,6 @@ Source Files - - Source Files - Source Files @@ -124,20 +124,17 @@ Source Files + + gaodelayer + + + OpenstreetLayer + Header Files - - Header Files - - - Header Files - - - Header Files - Header Files @@ -213,20 +210,23 @@ Header Files + + gaodelayer + + + gaodelayer + + + gaodelayer + - - Header Files - Header Files Header Files - - Header Files - Header Files @@ -242,6 +242,12 @@ Header Files + + gaodelayer + + + OpenstreetLayer + diff --git a/RasterMainWidgetGUI/RasterWidgetMessageShow.cpp b/RasterMainWidgetGUI/RasterWidgetMessageShow.cpp index d045371..184de1f 100644 --- a/RasterMainWidgetGUI/RasterWidgetMessageShow.cpp +++ b/RasterMainWidgetGUI/RasterWidgetMessageShow.cpp @@ -32,7 +32,7 @@ namespace RasterMessageShow { this->textBrowserMessage->append(Message); this->textBrowserMessage->moveCursor(QTextCursor::MoveOperation::End); this->textBrowserMessage->repaint(); - std::cout << Message.toLocal8Bit().constData() << std::endl; + //std::cout << Message.toLocal8Bit().constData() << std::endl; } else {} } diff --git a/Toolbox/BaseToolbox/BaseToolbox.cpp b/Toolbox/BaseToolbox/BaseToolbox.cpp index 22ed9c8..81c91b0 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.cpp +++ b/Toolbox/BaseToolbox/BaseToolbox.cpp @@ -123,7 +123,7 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi // 󳡾 #ifdef __BASETOOLBOX__SARSATALLITESIMULATIONWORKFLOW__H__ - initBaseToolSARSateSimulationWorkflow(toolbox); + // initBaseToolSARSateSimulationWorkflow(toolbox); #endif // __BASETOOLBOX__SARSATALLITESIMULATIONWORKFLOW__H__ diff --git a/Toolbox/BaseToolbox/BaseToolbox.vcxproj b/Toolbox/BaseToolbox/BaseToolbox.vcxproj index 1ace8fc..7ba7c25 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.vcxproj +++ b/Toolbox/BaseToolbox/BaseToolbox.vcxproj @@ -103,7 +103,7 @@ - ..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;.\BaseToolbox;..\..\RasterMainWidgetGUI\RasterMainWidget;..\..\RasterMainWidgetGUI;..\..\SPG4Tool;..\..\RasterProcessToolWidget;$(VC_IncludePath);$(WindowsSDK_IncludePath) + ..\..\GF3CalibrationAndOrthLib;..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;.\BaseToolbox;..\..\RasterMainWidgetGUI\RasterMainWidget;..\..\RasterMainWidgetGUI;..\..\SPG4Tool;..\..\RasterProcessToolWidget;$(VC_IncludePath);$(WindowsSDK_IncludePath) $(SolutionDir)$(Platform)\$(Configuration)\Toolbox\ PluginTool_$(ProjectName) true @@ -195,8 +195,6 @@ - - @@ -209,15 +207,11 @@ - - - - @@ -230,8 +224,6 @@ - - @@ -257,6 +249,9 @@ {872ecd6f-30e3-4a1b-b17c-15e87d373ff6} + + {886f7829-af74-4f23-b3be-29b7b3c9843c} + {b8b40c54-f7fe-4809-b6fb-8bc014570d7b} diff --git a/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters b/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters index dbe0ff5..399f5d8 100644 --- a/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters +++ b/Toolbox/BaseToolbox/BaseToolbox.vcxproj.filters @@ -32,18 +32,6 @@ Source Files - - BaseToolbox - - - BaseToolbox - - - BaseToolbox - - - BaseToolbox - BaseToolbox @@ -55,12 +43,6 @@ BaseToolbox - - BaseToolbox - - - BaseToolbox - BaseToolbox @@ -76,12 +58,6 @@ BaseToolbox - - BaseToolbox - - - BaseToolbox - BaseToolbox diff --git a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.h b/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.h deleted file mode 100644 index db71e8c..0000000 --- a/Toolbox/BaseToolbox/BaseToolbox/GF3CalibrationAndGeocodingClass.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once -#include "BaseConstVariable.h" -#include "ImageOperatorBase.h" -#include "LogInfoCls.h" -#include "SARSimulationImageL1.h" -#include "GF3PSTNClass.h" -#include - - -// ݶ -ErrorCode GF3CalibrationRaster(QString inRasterPath, QString outRasterPath, double Qualifyvalue, double calibrationConst); - -ErrorCode ImportGF3L1ARasterToWorkspace(QString inMetaxmlPath,QString inRasterPath, QString outWorkDirPath, POLARTYPEENUM polsartype); - -QVector SearchGF3DataTiff(QString inMetaxmlPath); - -POLARTYPEENUM getDatasetGF3FilePolsarType(QString fileName); - -ErrorCode ImportGF3L1AProcess(QString inMetaxmlPath, QString outWorkDirPath); - -// RD 㷨 -ErrorCode RD_PSTN(double& refrange,double& lamda, double& timeR, double& R, double& tx, double& ty, double& tz, double& slopex, double& slopey, double& slopez, GF3PolyfitSatelliteOribtModel& polyfitmodel, SatelliteOribtNode& node,double& d0,double& d1, double& d2, double& d3, double& d4); - - -//ұ -ErrorCode GF3RDCreateLookTable(QString inxmlPath, QString indemPath, QString outworkdir, QString outlooktablePath, QString outLocalIncidenceAnglePath, bool localincAngleFlag=false); -ErrorCode GF3OrthSLC( QString inRasterPath, QString inlooktablePath, QString outRasterPath); - -// 䴦 -ErrorCode GF3RDProcess(QString inxmlPath, QString indemPath, QString outworkdir, double gridx, double gridy); - diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.cpp b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.cpp new file mode 100644 index 0000000..8dbd2a0 --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.cpp @@ -0,0 +1,53 @@ +#include "KJ135WBJYAlgInterfaceToolbox.h" +#include "ToolBoxWidget.h" +#include "QWBFZAlgComponetXmlParamsDialog.h" +#include "QWBFZExcuteAlgProgramDialog.h" + +void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox) +{ + emit toolbox->addBoxToolItemSIGNAL(new WBFZAlgComponetLoadXmlParamsDialogToolButton(toolbox)); + emit toolbox->addBoxToolItemSIGNAL(new QWBFZExcuteAlgProgramDialogToolButton(toolbox)); +} + + +WBFZAlgComponetLoadXmlParamsDialogToolButton::WBFZAlgComponetLoadXmlParamsDialogToolButton(QWidget* parent) : QToolAbstract(parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"΢㷨"); + this->toolname = QString(u8"㷨xml"); +} + + +WBFZAlgComponetLoadXmlParamsDialogToolButton::~WBFZAlgComponetLoadXmlParamsDialogToolButton() +{ + + +} + +void WBFZAlgComponetLoadXmlParamsDialogToolButton::run() +{ + WBFZAlgComponetLoadXmlParamsProcess(); +} + + + +QWBFZExcuteAlgProgramDialogToolButton::QWBFZExcuteAlgProgramDialogToolButton(QWidget* parent) : QToolAbstract(parent) +{ + this->toolPath = QVector(0); + this->toolPath.push_back(u8"΢㷨"); + this->toolname = QString(u8"ִ΢㷨"); +} + +QWBFZExcuteAlgProgramDialogToolButton::~QWBFZExcuteAlgProgramDialogToolButton() +{ + +} + +void QWBFZExcuteAlgProgramDialogToolButton::run() +{ + QWBFZExcuteAlgProgramDialog* dialog = new QWBFZExcuteAlgProgramDialog(); + dialog->setWindowTitle(u8"ִ΢㷨"); + dialog->show(); + //dialog->exec(); + //dialog->deleteLater(); +} diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.h b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.h new file mode 100644 index 0000000..1c01d00 --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.h @@ -0,0 +1,57 @@ +#pragma once +/** +* ӽջĿ +* @file KJ2AlgInterfaceToolbox.h +* @brief KJ2AlgInterfaceToolbox.h +* @details +* ջĿĿļеIJļʾӦ㷨ִе +* +*/ +#ifndef __KJ2ALGINTERFACETOOLBOX_GLOBAL_H__ +#define __KJ2ALGINTERFACETOOLBOX_GLOBAL_H__ +#include "KJ135WBJYAlgInterfacetoolbox_global.h" +#include "QToolAbstract.h" + +namespace LAMPMainWidget { + class RasterMainWidget; +} + +class ToolBoxWidget; + + +extern "C" KJ2ALGINTERFACETOOLBOX_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox); + + + +/// +/// ؿջʮ΢㷨xml +/// +class KJ2ALGINTERFACETOOLBOX_EXPORT WBFZAlgComponetLoadXmlParamsDialogToolButton : public QToolAbstract { + Q_OBJECT +public: + WBFZAlgComponetLoadXmlParamsDialogToolButton(QWidget* parent = nullptr); + ~WBFZAlgComponetLoadXmlParamsDialogToolButton(); +public: + virtual void run() override; + +}; + + + +/// +/// ؿջʮ΢㷨ִн +/// +class KJ2ALGINTERFACETOOLBOX_EXPORT QWBFZExcuteAlgProgramDialogToolButton : public QToolAbstract { + Q_OBJECT +public: + QWBFZExcuteAlgProgramDialogToolButton(QWidget* parent = nullptr); + ~QWBFZExcuteAlgProgramDialogToolButton(); +public: + virtual void run() override; + +}; + + + + +#endif // __KJ2ALGINTERFACETOOLBOX_GLOBAL_H__ \ No newline at end of file diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.vcxproj b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.vcxproj new file mode 100644 index 0000000..f99433d --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.vcxproj @@ -0,0 +1,136 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {D3E9A2CA-7F05-425A-A4B6-416EC20972E8} + QtVS_v304 + 10.0 + 10.0 + $(MSBuildProjectDirectory)\QtMsBuild + KJ135WBJYAlgInterfaceToolbox + + + + DynamicLibrary + v143 + true + Unicode + + + DynamicLibrary + v143 + false + true + Unicode + + + + + + + tools_qt5 + core;gui;widgets + debug + + + tools_qt5 + core;xml;sql;opengl;gui;xmlpatterns;widgets;location;qml;positioning;printsupport;concurrent;3dcore;3danimation;3dextras;3dinput;3dlogic;3drender;dbus;gamepad;openglextensions;charts;datavisualization;purchasing + release + + + + + + + + + + + + + + + + + + + $(SolutionDir)$(Platform)\$(Configuration)\Toolbox\ + PluginTool_$(ProjectName) + ..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;.;..\..\RasterMainWidgetGUI\RasterMainWidget;..\..\RasterMainWidgetGUI;..\..\RasterProcessToolWidget;$(VC_IncludePath);$(WindowsSDK_IncludePath) + + + + true + KJ2ALGINTERFACETOOLBOX_LIB;%(PreprocessorDefinitions) + Level3 + true + true + + + Windows + true + + + + + true + KJ2ALGINTERFACETOOLBOX_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + Level3 + true + true + true + true + + + Windows + DebugFull + true + true + + + + + {872ecd6f-30e3-4a1b-b17c-15e87d373ff6} + + + {e56b3878-a3dc-41a4-abf3-b628816d0d64} + + + {7ef67daa-dbc0-4b7f-80e8-11b4d2cb7ec2} + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.vcxproj.filters b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.vcxproj.filters new file mode 100644 index 0000000..fb69b29 --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfaceToolbox.vcxproj.filters @@ -0,0 +1,72 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {99349809-55BA-4b9d-BF79-8FDBB0286EB3} + ui + + + {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} + ts + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Form Files + + + Form Files + + + \ No newline at end of file diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfacetoolbox_global.h b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfacetoolbox_global.h new file mode 100644 index 0000000..50ea4ad --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgInterfacetoolbox_global.h @@ -0,0 +1,13 @@ +#pragma once + +#include + +#ifndef BUILD_STATIC +# if defined(KJ2ALGINTERFACETOOLBOX_LIB) +# define KJ2ALGINTERFACETOOLBOX_EXPORT Q_DECL_EXPORT +# else +# define KJ2ALGINTERFACETOOLBOX_EXPORT Q_DECL_IMPORT +# endif +#else +# define KJ2ALGINTERFACETOOLBOX_EXPORT +#endif diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgWidgetComponet.cpp b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgWidgetComponet.cpp new file mode 100644 index 0000000..0215d97 --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgWidgetComponet.cpp @@ -0,0 +1,923 @@ +#include "KJ135WBJYAlgWidgetComponet.h" +#include +#include +#include + +AbstractComponentWidget::AbstractComponentWidget(QWidget* parent) :QWidget(parent) +{ + this->componentType = ComponentType::UNKNOW; // 默认未知类型 + this->ParaName = QString(); // 参数名称 + this->ParaChsName = QString(); // 参数中文名称 + this->Description = QString(); // 参数描述 + this->Datatype = QString(); // 数据类型 + this->ParaType = QString(); // 参数类型 +} + +AbstractComponentWidget::~AbstractComponentWidget() +{ + +} + +QString AbstractComponentWidget::getParaName() const +{ + return this->ParaName; +} + +void AbstractComponentWidget::setParaName(const QString& name) +{ + this->ParaName = name; +} + +QString AbstractComponentWidget::getParaChsName() const +{ + return this->ParaChsName; +} + +void AbstractComponentWidget::setParaChsName(const QString& name) +{ + this->ParaChsName = name; +} + +QString AbstractComponentWidget::getDescription() const +{ + + return this->Description; +} + +void AbstractComponentWidget::setDescription(const QString& description) +{ + this->setToolTip(description);// 绑定提示 + this->Description = description; +} + +QString AbstractComponentWidget::getDatatype() const +{ + return this->Datatype; +} + +void AbstractComponentWidget::setDatatype(const QString& datatype) +{ + this->Datatype = datatype; +} + +QString AbstractComponentWidget::getParaType() const +{ + return this->ParaType; +} + +void AbstractComponentWidget::setParaType(const QString& type) +{ + this->ParaType = type; +} + +void AbstractComponentWidget::setComponentType(ComponentType type) +{ + this->componentType = type; +} + +ComponentType AbstractComponentWidget::getComponentType() const +{ + return this->componentType; +} + +QString AbstractComponentWidget::getValue() const +{ + return QString(); +} + +void AbstractComponentWidget::initUI() +{ +} + +// File 文件选择 + +FileSelectWidget::FileSelectWidget(QWidget* parent) :AbstractComponentWidget(parent) +{ +} + +FileSelectWidget::~FileSelectWidget() +{ +} + +void FileSelectWidget::initUI() +{ + // 初始化控件 + // fileNameLabel + fileNameLabel = new QLabel(this); + fileNameLabel->setText(this->getParaName()); + + //filePathEdit + filePathEdit = new QLineEdit(this); + + // fileSelectButton + fileSelectButton = new QToolButton(this); + fileSelectButton->setText(u8"选择文件"); + + + + // 设置文件最小控件高度 + fileNameLabel->setMinimumHeight(40); + filePathEdit->setMinimumHeight(40); + fileSelectButton->setMinimumHeight(40); + + // 绑定信号-槽 + QObject::connect(fileSelectButton, SIGNAL(clicked()), this, SLOT(onFileSelectButtonClicked())); + + // 水平布局 + QHBoxLayout* layout = new QHBoxLayout(this); + layout->addWidget(fileNameLabel); + layout->addWidget(filePathEdit); + layout->addWidget(fileSelectButton); + this->setLayout(layout); +} + +QString FileSelectWidget::getValue() const +{ + if (nullptr != filePathEdit) + { + if (this->componentType == ComponentType::FolderSelect) { + //检测最后一个字符是否为分隔符 + QString filePath = filePathEdit->text(); + if (filePath.endsWith(QDir::separator())) { + return filePath; + } + else { + return QString(u8"%1%2").arg(filePath).arg(QDir::separator()); + } + } + else{ + return filePathEdit->text(); + } + + } + else { + QMessageBox::warning(nullptr, u8"警告", u8"请先选择文件"); + return QString(); + } +} + +void FileSelectWidget::onFileSelectButtonClicked() +{ + if (this->componentType == ComponentType::FileSelect) + { + QString fileName = QFileDialog::getOpenFileName(this, + QString(u8"选择%1").arg(this->getParaChsName()), + "", + QString(u8"所有文件(*.*);;%1文件(*.%2);;").arg(this->getDatatype()).arg(this->getDatatype())); + if (!fileName.isEmpty()) + { + filePathEdit->setText(fileName); + } + else { + QMessageBox::warning(this, u8"警告", u8"请选择文件"); + } + } + else if (this->componentType == ComponentType::MulitFileSelect) + { + QStringList fileName = QFileDialog::getOpenFileNames(this, + QString(u8"选择文件夹:%1").arg(this->getParaChsName()), + ""); + if (fileName.count() != 0) + { + QString filePathlist = fileName.at(0); + for (long i = 1; i < fileName.count(); i++) + { + filePathlist = QString(u8"%1;%2").arg(filePathlist).arg(fileName.at(i)); + } + filePathlist = QString(u8"%1;").arg(filePathlist); + filePathEdit->setText(filePathlist); + } + else { + QMessageBox::warning(this, u8"警告", u8"请选择文件夹"); + } + } + else if (this->componentType == ComponentType::FolderSelect) { + QString fileName = QFileDialog::getExistingDirectory(this, + QString(u8"选择文件夹:%1").arg(this->getParaChsName()), + ""); + if (!fileName.isEmpty()) + { + fileName = QString(u8"%1%2").arg(fileName).arg(QDir::separator()); + filePathEdit->setText(fileName); + } + else { + QMessageBox::warning(this, u8"警告", u8"请选择文件夹"); + } + } + else { + QMessageBox::warning(this, u8"警告", u8"参数控件格式错误"); + } +} + + + +// 整数输入组件 +IntInputWidget::IntInputWidget(QWidget* parent) :AbstractComponentWidget(parent) +{ + +} +IntInputWidget::~IntInputWidget() +{ +} + +void IntInputWidget::initUI() +{ + fileNameLabel = new QLabel(this); + fileNameLabel->setText(this->getParaName()); + + + intInput = new QSpinBox(this); + intInput->setRange(-920240809, 920240809); + intInput->setSingleStep(1); + + // 设置文件最小控件高度 + fileNameLabel->setMinimumHeight(40); + intInput->setMinimumHeight(40); + // 水平布局 + QHBoxLayout* layout = new QHBoxLayout(this); + layout->addWidget(fileNameLabel); + layout->addWidget(intInput); + this->setLayout(layout); +} + +QString IntInputWidget::getValue() const +{ + if (nullptr == this->intInput) + { + return QString(); + } + else { + return QString::number(this->intInput->value()); + } +} + +// 浮点数输入组件 + +DoubleInputWidget::DoubleInputWidget(QWidget* parent) :AbstractComponentWidget(parent) +{ +} + +DoubleInputWidget::~DoubleInputWidget() +{ +} + +void DoubleInputWidget::initUI() +{ + fileNameLabel = new QLabel(this); + fileNameLabel->setText(this->getParaName()); + + + doubleInput = new QLineEdit(this); + + + // 设置文件最小控件高度 + fileNameLabel->setMinimumHeight(40); + doubleInput->setMinimumHeight(40); + // 水平布局 + QHBoxLayout* layout = new QHBoxLayout(this); + layout->addWidget(fileNameLabel); + layout->addWidget(doubleInput); + this->setLayout(layout); +} + +QString DoubleInputWidget::getValue() const +{ + if (nullptr != this->doubleInput) + { + return this->doubleInput->text(); + } + else { + return QString(); + } +} + + + +// 整数输入组件 +ScopeIntInputWidget::ScopeIntInputWidget(QWidget* parent) :AbstractComponentWidget(parent) +{ + +} + +ScopeIntInputWidget::~ScopeIntInputWidget() +{ +} + +void ScopeIntInputWidget::initUI() +{ + fileNameLabel = new QLabel(this); + fileNameLabel->setText(this->getParaName()); + intInputMin = new QSpinBox(this); + intInputMin->setRange(-1000000, 1000000); + intInputMin->setSingleStep(1); + + scopeConnectStr = new QLabel(this); + scopeConnectStr->setText(u8" - "); + + intInputMax = new QSpinBox(this); + intInputMax->setRange(-1000000, 1000000); + intInputMax->setSingleStep(1); + + // 设置文件最小控件高度 + fileNameLabel->setMinimumHeight(40); + intInputMin->setMinimumHeight(40); + intInputMax->setMinimumHeight(40); + // 水平布局 + QHBoxLayout* layout = new QHBoxLayout(this); + layout->addWidget(fileNameLabel); + layout->addWidget(intInputMin); + layout->addWidget(scopeConnectStr); + layout->addWidget(intInputMax); + this->setLayout(layout); +} + + +QString ScopeIntInputWidget::getValue() const +{ + if (nullptr != intInputMin && nullptr != intInputMax) + { + return QString("%1;%2") + .arg(QString::number(intInputMin->value())) + .arg(QString::number(intInputMax->value())); + } + else { + QMessageBox::warning(nullptr, u8"警告", u8"请先输入"); + } + return QString(); +} + + + +// 浮点数输入组件 +ScopeDoubleInputWidget::ScopeDoubleInputWidget(QWidget* parent) :AbstractComponentWidget(parent) +{ +} + +ScopeDoubleInputWidget::~ScopeDoubleInputWidget() +{ +} + +void ScopeDoubleInputWidget::initUI() +{ + fileNameLabel = new QLabel(this); + fileNameLabel->setText(this->getParaName()); + doubleInputMin = new QLineEdit(this); + + + scopeConnectStr = new QLabel(this); + scopeConnectStr->setText(u8" - "); + + doubleInputMax = new QLineEdit(this); + + // 设置文件最小控件高度 + fileNameLabel->setMinimumHeight(40); + doubleInputMin->setMinimumHeight(40); + doubleInputMax->setMinimumHeight(40); + // 水平布局 + QHBoxLayout* layout = new QHBoxLayout(this); + layout->addWidget(fileNameLabel); + layout->addWidget(doubleInputMin); + layout->addWidget(scopeConnectStr); + layout->addWidget(doubleInputMax); + this->setLayout(layout); +} + +QString ScopeDoubleInputWidget::getValue() const +{ + if (nullptr != doubleInputMin && nullptr != doubleInputMax) + { + return QString("%1;%2") + .arg(doubleInputMin->text()) + .arg(doubleInputMax->text()); + } + else { + QMessageBox::warning(nullptr, u8"警告", u8"请先输入"); + } + return QString(); +} + +AbstractComponentWidget* createComponentWidgetFactory(QString ParaName, QString ParaChsName, QString Datatype, QString ParaType, QString Description, QWidget* parent) +{ + qDebug() << "createComponentWidgetFactory: " << ParaName << ParaChsName << Datatype << ParaType << Description; + if (QString::compare(ParaName, u8"WorkSpace", Qt::CaseInsensitive) == 0) { // 判断是否相等 + AbstractComponentWidget* workspacePathWidget = new FileSelectWidget(parent); + workspacePathWidget->setParaName(ParaName); + workspacePathWidget->setParaChsName(ParaChsName); + workspacePathWidget->setDescription(Description); + workspacePathWidget->setDatatype(Datatype); + workspacePathWidget->setComponentType(ComponentType::FolderSelect); + workspacePathWidget->initUI(); + return workspacePathWidget; + } + else if(QString::compare(ParaName, u8"box", Qt::CaseInsensitive) == 0 ){ // 包围盒 + AbstractComponentWidget* boxInpputWidget = new BoxDoubleInputWidget(parent); + boxInpputWidget->setParaName(ParaName); + boxInpputWidget->setParaChsName(ParaChsName); + boxInpputWidget->setDescription(Description); + boxInpputWidget->setDatatype(Datatype); + boxInpputWidget->setComponentType(ComponentType::BoxDoubleInput); + boxInpputWidget->initUI(); + return boxInpputWidget; + } + else if (QString::compare(ParaName, u8"CoveringIDs", Qt::CaseInsensitive) == 0 ) { // 地表覆盖类型 + AbstractComponentWidget* intInpputWidget = new MultiIntInputWidget(parent); + intInpputWidget->setParaName(ParaName); + intInpputWidget->setParaChsName(ParaChsName); + intInpputWidget->setDescription(Description); + intInpputWidget->setDatatype(Datatype); + intInpputWidget->setComponentType(ComponentType::MultiIntInput); + intInpputWidget->initUI(); + return intInpputWidget; + } + else if (QString::compare(ParaName, u8"NDVIScope", Qt::CaseInsensitive) == 0) { //NDVI 范围 + AbstractComponentWidget* scopeDoubleInputWidget = new ScopeDoubleInputWidget(parent); + scopeDoubleInputWidget->setParaName(ParaName); + scopeDoubleInputWidget->setParaChsName(ParaChsName); + scopeDoubleInputWidget->setDescription(Description); + scopeDoubleInputWidget->setDatatype(Datatype); + scopeDoubleInputWidget->setComponentType(ComponentType::ScopeDoubleInput); + scopeDoubleInputWidget->initUI(); + return scopeDoubleInputWidget; + } + else if (QString::compare(ParaName, u8"MainImg", Qt::CaseInsensitive) == 0 ) { // 浮点数输入 + AbstractComponentWidget* InputWidget = new IntInputWidget(parent); + InputWidget->setParaName(ParaName); + InputWidget->setParaChsName(ParaChsName); + InputWidget->setDescription(Description); + InputWidget->setDatatype(Datatype); + InputWidget->setComponentType(ComponentType::IntInput); + InputWidget->initUI(); + return InputWidget; + } + else if (QString::compare(ParaName, u8"SARS", Qt::CaseInsensitive) == 0 ) { // 浮点数输入 + AbstractComponentWidget* InputWidget = new FileSelectWidget(parent); + InputWidget->setParaName(ParaName); + InputWidget->setParaChsName(ParaChsName); + InputWidget->setDescription(Description); + InputWidget->setDatatype(Datatype); + InputWidget->setComponentType(ComponentType::MulitFileSelect); + InputWidget->initUI(); + return InputWidget; + } + else if (QString::compare(ParaName, u8"CorrectMethod", Qt::CaseInsensitive) == 0 ) { // 浮点数输入 + AbstractComponentWidget* scopeDoubleInputWidget = new CorrectMethodcomboxSelectWidget(parent); + scopeDoubleInputWidget->setParaName(ParaName); + scopeDoubleInputWidget->setParaChsName(ParaChsName); + scopeDoubleInputWidget->setDescription(Description); + scopeDoubleInputWidget->setDatatype(Datatype); + scopeDoubleInputWidget->setComponentType(ComponentType::IntInput); + scopeDoubleInputWidget->initUI(); + return scopeDoubleInputWidget; + } + else if (QString::compare(ParaName, u8"FeatureCombination", Qt::CaseInsensitive) == 0) { // 浮点数输入 + AbstractComponentWidget* InputWidget = new FeatureCombinationMultiIntInputWidget(parent); + InputWidget->setParaName(ParaName); + InputWidget->setParaChsName(ParaChsName); + InputWidget->setDescription(Description); + InputWidget->setDatatype(Datatype); + InputWidget->setComponentType(ComponentType::IntInput); + InputWidget->initUI(); + return InputWidget; + } + else if (QString::compare(ParaType, u8"Value", Qt::CaseInsensitive) == 0 && QString::compare(Datatype, u8"string", Qt::CaseInsensitive) == 0) { + AbstractComponentWidget* InputWidget = new StringInputWidget(parent); + InputWidget->setParaName(ParaName); + InputWidget->setParaChsName(ParaChsName); + InputWidget->setDescription(Description); + InputWidget->setDatatype(Datatype); + InputWidget->setComponentType(ComponentType::IntInput); + InputWidget->initUI(); + return InputWidget; + } + else if (QString::compare(ParaType, u8"Value", Qt::CaseInsensitive) == 0 && QString::compare(Datatype, u8"float", Qt::CaseInsensitive) == 0) { // 浮点数输入 + AbstractComponentWidget* InputWidget = new DoubleInputWidget(parent); + InputWidget->setParaName(ParaName); + InputWidget->setParaChsName(ParaChsName); + InputWidget->setDescription(Description); + InputWidget->setDatatype(Datatype); + InputWidget->setComponentType(ComponentType::DoubleInput); + InputWidget->initUI(); + return InputWidget; + } + else if (QString::compare(ParaType, u8"File", Qt::CaseInsensitive) == 0 && QString::compare(Datatype, u8"File", Qt::CaseInsensitive) == 0) { // 强制选择文件夹 + AbstractComponentWidget* fileSelectWidget = new FileSelectWidget(parent); + fileSelectWidget->setParaName(ParaName); + fileSelectWidget->setParaChsName(ParaChsName); + fileSelectWidget->setDescription(Description); + fileSelectWidget->setDatatype(Datatype); + fileSelectWidget->setComponentType(ComponentType::FolderSelect); + fileSelectWidget->initUI(); + return fileSelectWidget; + } + else if (QString::compare(ParaType, u8"File", Qt::CaseInsensitive) == 0 && QString::compare(Datatype, u8"tar.gz", Qt::CaseInsensitive) == 0) {// 选择文件 + AbstractComponentWidget* fileSelectWidget = new FileSelectWidget(parent); + fileSelectWidget->setParaName(ParaName); + fileSelectWidget->setParaChsName(ParaChsName); + fileSelectWidget->setDescription(Description); + fileSelectWidget->setDatatype(Datatype); + fileSelectWidget->setComponentType(ComponentType::FileSelect); + fileSelectWidget->initUI(); + return fileSelectWidget; + } + else if (QString::compare(ParaType, u8"File", Qt::CaseInsensitive) == 0) {// 选择文件 + AbstractComponentWidget* fileSelectWidget = new FileSelectWidget(parent); + fileSelectWidget->setParaName(ParaName); + fileSelectWidget->setParaChsName(ParaChsName); + fileSelectWidget->setDescription(Description); + fileSelectWidget->setDatatype(Datatype); + fileSelectWidget->setComponentType(ComponentType::MulitFileSelect); + fileSelectWidget->initUI(); + return fileSelectWidget; + } + return nullptr; +} + +BoxDoubleInputWidget::BoxDoubleInputWidget(QWidget* parent) :AbstractComponentWidget(parent) +{ +} + +BoxDoubleInputWidget::~BoxDoubleInputWidget() +{ +} + +void BoxDoubleInputWidget::initUI() +{ + // 修改提示 + this->Description = QString(u8"%1;不填参数请填写empty作为不填写指令").arg(this->Description); + this->setToolTip(this->Description); + + fileNameLabel = new QLabel(this); + fileNameLabel->setText(this->getParaName()); + doubleInputMin = new QLineEdit(this); + doubleInputMin->setPlaceholderText(u8"请输入包围盒参数"); + // 设置文件最小控件高度 + fileNameLabel->setMinimumHeight(40); + doubleInputMin->setMinimumHeight(40); + // 水平布局 + QHBoxLayout* layout = new QHBoxLayout(this); + layout->addWidget(fileNameLabel); + layout->addWidget(doubleInputMin); + this->setLayout(layout); +} + +QString BoxDoubleInputWidget::getValue() const +{ + QString valuestr = this->doubleInputMin->text(); + // 非法性检查 + if (valuestr.isEmpty()) + { + QMessageBox::warning(nullptr, u8"警告", u8"请先输入"); + return QString(); + } + else if (valuestr.compare("empty", Qt::CaseSensitive) == 0) + { + return QString("empty"); + } + else { + // 经纬度包围盒SNWE。例子:30.0;30.2;117.3;117.5 37;38.2;108.87;109.1 , 请根据例子给出规则检查代码 + + QStringList list = valuestr.split(";"); + if (list.size() != 4) + { + QMessageBox::warning(nullptr, u8"警告", QString(u8"包围盒参数格式错误\n%1").arg(this->Description)); + return QString("empty"); + } + for (int i = 0; i < list.size(); i++) + { + bool ok; + double value = list.at(i).toDouble(&ok); + if (!ok) + { + QMessageBox::warning(nullptr, u8"警告", QString(u8"包围盒参数格式错误\n%1").arg(this->Description)); + return QString("empty"); + } + } + return valuestr; + } + return QString("empty"); +} + + +MultiIntInputWidget::MultiIntInputWidget(QWidget* parent) +{ +} + +MultiIntInputWidget::~MultiIntInputWidget() +{ +} + +void MultiIntInputWidget::initUI() +{ + fileNameLabel = new QLabel(this); + fileNameLabel->setText(this->getParaName()); + IntInputMin = new QLineEdit(this); + IntInputMin->setPlaceholderText(u8"请输入整数"); + // 设置文件最小控件高度 + fileNameLabel->setMinimumHeight(40); + IntInputMin->setMinimumHeight(40); + // 水平布局 + QHBoxLayout* layout = new QHBoxLayout(this); + layout->addWidget(fileNameLabel); + layout->addWidget(IntInputMin); + this->setLayout(layout); +} + +QString MultiIntInputWidget::getValue() const +{ + QString valuestr = this->IntInputMin->text(); + // 非法性检查 + if (valuestr.isEmpty()) + { + QMessageBox::warning(nullptr, u8"警告", u8"请先输入"); + return QString(); + } + else if (valuestr.compare("empty", Qt::CaseSensitive) == 0) + { + return QString("empty"); + } + else { + QStringList list = valuestr.split(";"); + for (int i = 0; i < list.size(); i++) + { + bool ok; + int value = list.at(i).toInt(&ok); + if (!ok) + { + QMessageBox::warning(nullptr, u8"警告", QString(u8"整数参数格式错误\n%1").arg(this->Description)); + return QString("empty"); + } + } + return valuestr; + } + return QString("empty"); +} + +MultiDoubleInputWidget::MultiDoubleInputWidget(QWidget* parent) +{ +} + +MultiDoubleInputWidget::~MultiDoubleInputWidget() +{ +} + +void MultiDoubleInputWidget::initUI() +{ + fileNameLabel = new QLabel(this); + fileNameLabel->setText(this->getParaName()); + doubleInputMin = new QLineEdit(this); + doubleInputMin->setPlaceholderText(u8"请输入浮点数"); + // 设置文件最小控件高度 + fileNameLabel->setMinimumHeight(40); + doubleInputMin->setMinimumHeight(40); + // 水平布局 + QHBoxLayout* layout = new QHBoxLayout(this); + layout->addWidget(fileNameLabel); + layout->addWidget(doubleInputMin); + this->setLayout(layout); +} + +QString MultiDoubleInputWidget::getValue() const +{ + QString valuestr = this->doubleInputMin->text(); + // 非法性检查 + if (valuestr.isEmpty()) + { + QMessageBox::warning(nullptr, u8"警告", u8"请先输入"); + return QString(); + } + else if (valuestr.compare("empty", Qt::CaseSensitive) == 0) + { + return QString("empty"); + } + else { + QStringList list = valuestr.split(";"); + for (int i = 0; i < list.size(); i++) + { + bool ok; + double value = list.at(i).toDouble(&ok); + if (!ok) + { + QMessageBox::warning(nullptr, u8"警告", QString(u8"浮点数参数格式错误\n%1").arg(this->Description)); + return QString("empty"); + } + } + return valuestr; + } + return QString("empty"); +} + + +CorrectMethodcomboxSelectWidget::CorrectMethodcomboxSelectWidget(QWidget* parent) +{ +} + +CorrectMethodcomboxSelectWidget::~CorrectMethodcomboxSelectWidget() +{ +} + +void CorrectMethodcomboxSelectWidget::initUI() +{ + fileNameLabel = new QLabel(this); + fileNameLabel->setText(this->getParaName()); + comboxSelect = new QComboBox(this); + comboxSelect->addItem(u8"2:RD"); + // 设置文件最小控件高度 + fileNameLabel->setMinimumHeight(40); + comboxSelect->setMinimumHeight(40); + // 水平布局 + QHBoxLayout* layout = new QHBoxLayout(this); + layout->addWidget(fileNameLabel); + layout->addWidget(comboxSelect); + this->setLayout(layout); + comboxSelect->setEnabled(false); +} + +QString CorrectMethodcomboxSelectWidget::getValue() const +{ + return u8"2"; +} + +FeatureCombinationMultiIntInputWidget::FeatureCombinationMultiIntInputWidget(QWidget* parent) +{ +} + +FeatureCombinationMultiIntInputWidget::~FeatureCombinationMultiIntInputWidget() +{ +} + +void FeatureCombinationMultiIntInputWidget::initUI() +{ + /* + 根据下面的参数,设置一个 checkbox 阵列 + Freeman:表面散射p_s(0)、偶次散射p_d(1)、体散射p_v(2); + Touzi:散射角α_s(3)、散射相位ϕ_α(4)、目标散射对称度τ(5)、相对能量λ_i(6); + Yamaguchi:表面散射f_s(7)、二次散射f_d(8)、体散射f_v(9)、螺旋体散射f_h(10); + Cloude-Pottier:分解散射熵H(11)、反熵A(12)、平均散射角α(13)*/ + fileNameLabel = new QLabel(this); + fileNameLabel->setText(this->getParaName()); + + + // 不同控件checkbox 初始化 + checkbox0 = new QCheckBox(u8"表面散射p_s(0)", this); + checkbox1 = new QCheckBox(u8"偶次散射p_d(1)", this); + checkbox2 = new QCheckBox(u8"体散射p_v(2)", this); + checkbox3 = new QCheckBox(u8"散射角α_s(3)", this); + checkbox4 = new QCheckBox(u8"散射相位ϕ_α(4)", this); + checkbox5 = new QCheckBox(u8"目标散射对称度τ(5)", this); + checkbox6 = new QCheckBox(u8"相对能量λ_i(6)", this); + checkbox7 = new QCheckBox(u8"表面散射f_s(7)", this); + checkbox8 = new QCheckBox(u8"二次散射f_d(8)", this); + checkbox9 = new QCheckBox(u8"体散射f_v(9)", this); + checkbox10 = new QCheckBox(u8"螺旋体散射f_h(10)", this); + checkbox11 = new QCheckBox(u8"分解散射熵H(11)", this); + checkbox12 = new QCheckBox(u8"反熵A(12)", this); + checkbox13 = new QCheckBox(u8"平均散射角α(13)", this); + // 设置文件最小控件高度 + fileNameLabel->setMinimumHeight(40); + checkbox0->setMinimumHeight(40); + checkbox1->setMinimumHeight(40); + checkbox2->setMinimumHeight(40); + checkbox3->setMinimumHeight(40); + checkbox4->setMinimumHeight(40); + checkbox5->setMinimumHeight(40); + checkbox6->setMinimumHeight(40); + checkbox7->setMinimumHeight(40); + checkbox8->setMinimumHeight(40); + checkbox9->setMinimumHeight(40); + checkbox10->setMinimumHeight(40); + checkbox11->setMinimumHeight(40); + checkbox12->setMinimumHeight(40); + checkbox13->setMinimumHeight(40); + // 垂直布局,并按照Freeman、Touzi、Yamaguchi、Cloude-Pottier的分组,每一个分组使用一个QGroupBox,水平 + QVBoxLayout* layout = new QVBoxLayout(this); + layout->addWidget(fileNameLabel); + QGroupBox* FreemanGroup = new QGroupBox(u8"Freeman", this); + QHBoxLayout* FreemanLayout = new QHBoxLayout(FreemanGroup); + FreemanLayout->addWidget(checkbox0); + FreemanLayout->addWidget(checkbox1); + FreemanLayout->addWidget(checkbox2); + QGroupBox* TouziGroup = new QGroupBox(u8"Touzi", this); + QHBoxLayout* TouziLayout = new QHBoxLayout(TouziGroup); + TouziLayout->addWidget(checkbox3); + TouziLayout->addWidget(checkbox4); + TouziLayout->addWidget(checkbox5); + TouziLayout->addWidget(checkbox6); + QGroupBox* YamaguchiGroup = new QGroupBox(u8"Yamaguchi", this); + QHBoxLayout* YamaguchiLayout = new QHBoxLayout(YamaguchiGroup); + YamaguchiLayout->addWidget(checkbox7); + YamaguchiLayout->addWidget(checkbox8); + YamaguchiLayout->addWidget(checkbox9); + YamaguchiLayout->addWidget(checkbox10); + QGroupBox* CloudePottierGroup = new QGroupBox(u8"Cloude-Pottier", this); + QHBoxLayout* CloudePottierLayout = new QHBoxLayout(CloudePottierGroup); + CloudePottierLayout->addWidget(checkbox11); + CloudePottierLayout->addWidget(checkbox12); + CloudePottierLayout->addWidget(checkbox13); + layout->addWidget(FreemanGroup); + layout->addWidget(TouziGroup); + layout->addWidget(YamaguchiGroup); + layout->addWidget(CloudePottierGroup); + this->setLayout(layout); +} + +QString FeatureCombinationMultiIntInputWidget::getValue() const +{ + + // 检查所有的checkbox是否被选中,然后给出形如0,1,2,7,8,9,10的字符串 + QString valuestr = QString(); + if (checkbox0->isChecked()) + { + valuestr += "0,"; + } + if (checkbox1->isChecked()) + { + valuestr += "1,"; + } + if (checkbox2->isChecked()) + { + valuestr += "2,"; + } + if (checkbox3->isChecked()) + { + valuestr += "3,"; + } + if (checkbox4->isChecked()) + { + valuestr += "4,"; + } + if (checkbox5->isChecked()) + { + valuestr += "5,"; + } + if (checkbox6->isChecked()) + { + valuestr += "6,"; + } + if (checkbox7->isChecked()) + { + valuestr += "7,"; + } + if (checkbox8->isChecked()) + { + valuestr += "8,"; + } + if (checkbox9->isChecked()) + { + valuestr += "9,"; + } + if (checkbox10->isChecked()) + { + valuestr += "10,"; + } + if (checkbox11->isChecked()) + { + valuestr += "11,"; + } + if (checkbox12->isChecked()) + { + valuestr += "12,"; + } + if (checkbox13->isChecked()) + { + valuestr += "13,"; + } + // 去掉最后一个逗号 + if (valuestr.length() > 0) + { + valuestr = valuestr.left(valuestr.length() - 1); + } + else { + QMessageBox::warning(nullptr, u8"警告", u8"请至少选择一个参数"); + return QString(); + } + return valuestr; +} + +StringInputWidget::StringInputWidget(QWidget* parent) +{ +} + +StringInputWidget::~StringInputWidget() +{ +} + +void StringInputWidget::initUI() +{ + fileNameLabel = new QLabel(this); + fileNameLabel->setText(this->getParaName()); + IntInputMin = new QLineEdit(this); + IntInputMin->setPlaceholderText(u8"请输入"); + // 设置文件最小控件高度 + fileNameLabel->setMinimumHeight(40); + IntInputMin->setMinimumHeight(40); + // 水平布局 + QHBoxLayout* layout = new QHBoxLayout(this); + layout->addWidget(fileNameLabel); + layout->addWidget(IntInputMin); + this->setLayout(layout); +} + +QString StringInputWidget::getValue() const +{ + return IntInputMin->text(); +} diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgWidgetComponet.h b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgWidgetComponet.h new file mode 100644 index 0000000..67305da --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/KJ135WBJYAlgWidgetComponet.h @@ -0,0 +1,341 @@ +#pragma once + +/** +* 空基十三五微波算法组件界面组件类集 +* @file KJ135WBJYAlgWidgetComponet.h +* @brief KJ135WBJYAlgWidgetComponet.h +* @details +* 空基十三五微波算法组件界面组件类集 +*/ + +#ifndef __KJ135WBJYAlgInterfaceToolbox_GLOBAL_H__ +#define __KJ135WBJYAlgInterfaceToolbox_GLOBAL_H__ + +#include "KJ135WBJYAlgInterfaceToolbox_global.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + + +/// +/// 参数类型枚举 +/// +enum ComponentType{ + UNKNOW = 0, // 未知类型 + WorkSpace, // 工作空间路径 + FileSelect , // 文件选择 + MulitFileSelect , // 文件选择 + FolderSelect, // 文件夹选择 + ComboxSelect,// 枚举多选 + IntInput,// 整数输入 + stringInput, + BoxDoubleInput,// 复选框浮点数输入 + DoubleInput,// 浮点数输入 + MultipleSelect,// 多选 + MultiIntInput,// 整数多选输入 + MultiDoubleInput,// 浮点数多选输入 + ScopeIntInput,// 整数范围输入 + ScopeDoubleInput,// 浮点数范围输入 + +}; + + + + + +/** + +CoveringIDs +地表覆盖类型数据的类别id +地表覆盖类型数据中植被区域、裸土区域的类别id,多个id使用“;”分割。示例:GlobeLand30数据的cover_roi_ids = 10;20;30;40;50;70;71;72;83;74;90 +Value +string +Man +1;4;5;6;7;11;10;20;30;50;60;70;71;72;73;74;80;90;255 +True +False +UploadInput +Aux +0 +Aux +DEFAULT +DEFAULT +DEFAULT +DEFAULT +DEFAULT + + +**/ + +class AbstractComponentWidget : public QWidget +{ + Q_OBJECT +public: + AbstractComponentWidget(QWidget* parent = nullptr); + ~AbstractComponentWidget(); + +protected: + QString ParaName; // 参数名称 + QString ParaChsName;// 参数中文名称 + QString Description;// 参数描述 + + QString Datatype;// 数据类型 Value // 决定参数的输入类型 + QString ParaType;// 参数类型 string + + ComponentType componentType = ComponentType::UNKNOW; // 组件类型 +public://属性操作 + QString getParaName() const; + void setParaName(const QString& name); + // 设置参数中文名称 + QString getParaChsName() const; + void setParaChsName(const QString& name); + // 设置参数描述 + QString getDescription() const; + void setDescription(const QString& description); + // 设置数据类型 + QString getDatatype() const; + void setDatatype(const QString& datatype); + // 设置参数类型 + QString getParaType() const; + void setParaType(const QString& type); + + void setComponentType(ComponentType type); + ComponentType getComponentType() const; + + virtual QString getValue() const; + virtual void initUI(); +}; + +/// +/// File 文件选择组件 +/// +class FileSelectWidget : public AbstractComponentWidget +{ + Q_OBJECT +public: + FileSelectWidget(QWidget* parent = nullptr); + ~FileSelectWidget(); + virtual void initUI() override; +private: + QLabel* fileNameLabel=nullptr; // 文件名称 + QLineEdit* filePathEdit = nullptr; + QToolButton* fileSelectButton = nullptr; + public slots: + void onFileSelectButtonClicked(); +public: + virtual QString getValue() const override; + }; + +/// +/// int输入组件 +/// +class IntInputWidget : public AbstractComponentWidget +{ + Q_OBJECT +public: + IntInputWidget(QWidget* parent = nullptr); + ~IntInputWidget(); + virtual void initUI() override; +private: + QLabel* fileNameLabel = nullptr; // 文件名称 + QSpinBox* intInput = nullptr; + +public: + virtual QString getValue() const override; + +}; + +/// +/// double 输入组件 +/// +class DoubleInputWidget : public AbstractComponentWidget +{ + Q_OBJECT +public: + DoubleInputWidget(QWidget* parent = nullptr); + ~DoubleInputWidget(); + virtual void initUI() override; +private: + QLabel* fileNameLabel = nullptr; // 文件名称 + QLineEdit* doubleInput = nullptr; + public: + virtual QString getValue() const override; + }; + +/// +/// 整数值 数据范围输入组件 +/// +class ScopeIntInputWidget : public AbstractComponentWidget +{ + Q_OBJECT +public: + ScopeIntInputWidget(QWidget* parent = nullptr); + ~ScopeIntInputWidget(); + virtual void initUI() override; +private: + QLabel* fileNameLabel = nullptr; // 文件名称 + QLabel* scopeConnectStr = nullptr; // 文件名称 + QSpinBox* intInputMin = nullptr; + QSpinBox* intInputMax = nullptr; +public: + virtual QString getValue() const override; +}; + + +/// +/// 浮点数值 数据范围输入组件 +/// +class ScopeDoubleInputWidget : public AbstractComponentWidget +{ + Q_OBJECT +public: + ScopeDoubleInputWidget(QWidget* parent = nullptr); + ~ScopeDoubleInputWidget(); + virtual void initUI() override; +private: + QLabel* fileNameLabel = nullptr; // 文件名称 + QLabel* scopeConnectStr = nullptr; // 文件名称 + QLineEdit* doubleInputMin = nullptr; + QLineEdit* doubleInputMax = nullptr; +public: + virtual QString getValue() const override; +}; + + + +class BoxDoubleInputWidget : public AbstractComponentWidget +{ + Q_OBJECT +public: + BoxDoubleInputWidget(QWidget* parent = nullptr); + ~BoxDoubleInputWidget(); + virtual void initUI() override; +private: + QLabel* fileNameLabel = nullptr; // 文件名称 + QLineEdit* doubleInputMin = nullptr; +public: + virtual QString getValue() const override; +}; + +class MultiIntInputWidget : public AbstractComponentWidget +{ + Q_OBJECT +public: + MultiIntInputWidget(QWidget* parent = nullptr); + ~MultiIntInputWidget(); + virtual void initUI() override; +private: + QLabel* fileNameLabel = nullptr; // 文件名称 + QLineEdit* IntInputMin = nullptr; +public: + virtual QString getValue() const override; +}; + +class MultiDoubleInputWidget : public AbstractComponentWidget +{ + Q_OBJECT +public: + MultiDoubleInputWidget(QWidget* parent = nullptr); + ~MultiDoubleInputWidget(); + virtual void initUI() override; +private: + QLabel* fileNameLabel = nullptr; // 文件名称 + QLineEdit* doubleInputMin = nullptr; +public: + virtual QString getValue() const override; +}; + + +class CorrectMethodcomboxSelectWidget : public AbstractComponentWidget +{ + Q_OBJECT +public: + CorrectMethodcomboxSelectWidget(QWidget* parent = nullptr); + ~CorrectMethodcomboxSelectWidget(); + virtual void initUI() override; +private: + QLabel* fileNameLabel = nullptr; // 文件名称 + QComboBox* comboxSelect = nullptr; +public: + virtual QString getValue() const override; +}; + + +class FeatureCombinationMultiIntInputWidget : public AbstractComponentWidget +{ + Q_OBJECT +public: + FeatureCombinationMultiIntInputWidget(QWidget* parent = nullptr); + ~FeatureCombinationMultiIntInputWidget(); + virtual void initUI() override; +private: + QLabel* fileNameLabel = nullptr; // 文件名称 + /* +根据下面的参数,设置一个 checkbox 阵列 + Freeman:表面散射p_s(0)、偶次散射p_d(1)、体散射p_v(2); + Touzi:散射角α_s(3)、散射相位ϕ_α(4)、目标散射对称度τ(5)、相对能量λ_i(6); + Yamaguchi:表面散射f_s(7)、二次散射f_d(8)、体散射f_v(9)、螺旋体散射f_h(10); + Cloude-Pottier:分解散射熵H(11)、反熵A(12)、平均散射角α(13)*/ + QCheckBox* checkbox0 = nullptr; // 表面散射 + QCheckBox* checkbox1 = nullptr; // 偶次散射p_d + QCheckBox* checkbox2 = nullptr; // 体散射p_v + QCheckBox* checkbox3 = nullptr; // 散射角α_s + QCheckBox* checkbox4 = nullptr; // 散射相位ϕ_α + QCheckBox* checkbox5 = nullptr; // 目标散射对称度τ + QCheckBox* checkbox6 = nullptr; // 相对能量λ_i + QCheckBox* checkbox7 = nullptr; // 表面散射f_s + QCheckBox* checkbox8 = nullptr; // 二次散射f_d + QCheckBox* checkbox9 = nullptr; // 体散射f_v + QCheckBox* checkbox10 = nullptr; // 螺旋体散射f_h + QCheckBox* checkbox11 = nullptr; // 分解散射熵H + QCheckBox* checkbox12 = nullptr; // 反熵A + QCheckBox* checkbox13 = nullptr; // 平均散射角α + +public: + virtual QString getValue() const override; +}; + + +class StringInputWidget :public AbstractComponentWidget +{ + Q_OBJECT +public: + StringInputWidget(QWidget* parent = nullptr); + ~StringInputWidget(); + virtual void initUI() override; +private: + QLabel* fileNameLabel = nullptr; // 文件名称 + QLineEdit* IntInputMin = nullptr; +public: + virtual QString getValue() const override; +}; + + +/// +/// 参数文件工厂 +/// +/// 参数名称 +/// 参数中文别名 +/// 数据类型 +/// 参数类型 +/// 描述 +/// 父控件 +/// +AbstractComponentWidget* createComponentWidgetFactory(QString ParaName, QString ParaChsName, QString Datatype, QString ParaType, QString Description,QWidget* parent = nullptr); + + + + +#endif// __KJ135WBJYAlgInterfaceToolbox_GLOBAL_H__ + diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.cpp b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.cpp new file mode 100644 index 0000000..8f77424 --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.cpp @@ -0,0 +1,132 @@ +#include "QWBFZAlgComponetXmlParamsDialog.h" +#include "ui_QWBFZAlgComponetXmlParamsDialog.h" +#include +#include +#include "WBFZAlgComponetXmlParaseOperator.h" +#include "FileOperator.h" +QWBFZAlgComponetXmlParamsDialog::QWBFZAlgComponetXmlParamsDialog(QWidget *parent) + : QDialog(parent), + ui(new Ui::QWBFZAlgComponetXmlParamsDialogClass) +{ + ui->setupUi(this); + + // ź- + QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(OnacceptButton_Clicked())); + QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(OncancelButton_Clicked())); + + + + +} + +QWBFZAlgComponetXmlParamsDialog::~QWBFZAlgComponetXmlParamsDialog() +{ + delete ui; + delete xmlParseOperator; +} + +void QWBFZAlgComponetXmlParamsDialog::OnacceptButton_Clicked() +{ + // ȡֵ + QString workspacePath = workspacePathWidget->getValue(); + qDebug() << "workspacePath:" << workspacePath; + QMap parameterMap; + for (long i = 0; i < parameterWidgetList.size(); i++) + { + AbstractComponentWidget* parameterWidget = parameterWidgetList.at(i); + QString parameterValue = parameterWidget->getValue(); + qDebug() << "parameterValue:" << parameterValue; + parameterMap.insert(parameterWidget->getParaName(), parameterValue); + } + + // 1. ȡxmlļģ· + QString formatxmlpath = this->formatxmlString; + // 2. ȡxmlļ· + QString filepath = QFileDialog::getSaveFileName(this, u8"xmlļ", "", u8"xmlļ(*.xml)"); + if (filepath.isEmpty()) + { + QMessageBox::warning(this, u8"", u8"ѡxmlļ"); + return; + } + else { + qDebug() << "filepath:" << filepath; + } + xmlParseOperator = new WBFZAlgComponetXmlParaseOperator(this); + xmlParseOperator->writeXmlFile(formatxmlString, filepath, workspacePath,parameterMap); + // 3. رմ + QMessageBox::information(nullptr, u8"ʾ", u8"д"); +} + +void QWBFZAlgComponetXmlParamsDialog::OncancelButton_Clicked() +{ + this->close(); +} + +void QWBFZAlgComponetXmlParamsDialog::loadXmlFile(const QString& fileName) +{ + if (nullptr != xmlParseOperator) + { + delete xmlParseOperator; + xmlParseOperator = nullptr; + } + else {} + this->formatxmlString = fileName; + // xml + xmlParseOperator = new WBFZAlgComponetXmlParaseOperator(this); + xmlParseOperator->loadXmlFile(fileName); + + // ݽui + // 1. workspace· + workspacePathWidget = new FileSelectWidget(this); + workspacePathWidget->setParaName("WorkSpace"); + workspacePathWidget->setParaChsName(u8"ռ·"); + workspacePathWidget->setDescription(u8"ռ·"); + workspacePathWidget->setDatatype(u8"string"); + workspacePathWidget->setComponentType(ComponentType::FolderSelect); + workspacePathWidget->initUI(); + + ui->verticalLayout_param->addWidget(workspacePathWidget); + // 2. б + QList < WBFZAlgComponetXmlParamenterItem*> parameterList = xmlParseOperator->getParameterList(); + for (long i = 0; i < parameterList.size(); i++) + { + WBFZAlgComponetXmlParamenterItem* item = parameterList.at(i); + qDebug() << "item->getParaName():" << item->getParaName(); + // + AbstractComponentWidget* parameterWidget = createComponentWidgetFactory( + item->getParaName(), + item->getParaChsName(), + item->getDatatype(), + item->getParaType(), + item->getDescription(), + this); + //parameterWidget->initUI(); + + ui->verticalLayout_param->addWidget(parameterWidget); + + this->parameterWidgetList.append(parameterWidget); + + } + +} + +void WBFZAlgComponetLoadXmlParamsProcess() +{ + QString xmlFileName = QFileDialog::getOpenFileName(nullptr, u8"ѡ㷨xmlļ", "", u8"xmlļ(*.xml)"); + if (xmlFileName.isEmpty()) + { + QMessageBox::warning(nullptr, u8"", u8"ѡ㷨xmlļ"); + return; + } + else { + // TODO: xmlļز + qDebug() << "xmlFileName:" << xmlFileName; + + QWBFZAlgComponetXmlParamsDialog* dialog = new QWBFZAlgComponetXmlParamsDialog(); + dialog->setWindowTitle(QString(u8"㷨xmlļ-%1").arg(getFileNameFromPath(xmlFileName))); + dialog->loadXmlFile(xmlFileName); + dialog->show(); + return; + } + return; +} diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.h b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.h new file mode 100644 index 0000000..15e1485 --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.h @@ -0,0 +1,52 @@ +#pragma once + +#include + + +namespace Ui +{ + class QWBFZAlgComponetXmlParamsDialogClass; +} + +class WBFZAlgComponetXmlParaseOperator; +class AbstractComponentWidget; // 㷨 + +class QWBFZAlgComponetXmlParamsDialog : public QDialog +{ + Q_OBJECT + +public: + QWBFZAlgComponetXmlParamsDialog(QWidget *parent = nullptr); + ~QWBFZAlgComponetXmlParamsDialog(); + +private: + Ui::QWBFZAlgComponetXmlParamsDialogClass* ui; + QString formatxmlString; // ʽַ +public slots: + void OnacceptButton_Clicked(); // ȷť¼ + void OncancelButton_Clicked(); // ȡť¼ + + +private: + WBFZAlgComponetXmlParaseOperator* xmlParseOperator = nullptr; // 㷨xml +public: + void loadXmlFile(const QString& fileName); // xmlļ + +private: // ؼ + AbstractComponentWidget* workspacePathWidget = nullptr; // ռ· + QList parameterWidgetList; // б + + +}; + + + + + +// ΢㷨xmlȾ +void WBFZAlgComponetLoadXmlParamsProcess(); + + + + + diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.ui b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.ui new file mode 100644 index 0000000..8ae3d0d --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZAlgComponetXmlParamsDialog.ui @@ -0,0 +1,54 @@ + + + QWBFZAlgComponetXmlParamsDialogClass + + + + 0 + 0 + 600 + 400 + + + + QWBFZAlgComponetXmlParamsDialog + + + + + + + + + true + + + + + 0 + 0 + 580 + 351 + + + + + + + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZExcuteAlgProgramDialog.cpp b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZExcuteAlgProgramDialog.cpp new file mode 100644 index 0000000..99c3c13 --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZExcuteAlgProgramDialog.cpp @@ -0,0 +1,94 @@ +#include "QWBFZExcuteAlgProgramDialog.h" +#include "ui_QWBFZExcuteAlgProgramDialog.h" +#include "KJ135WBJYAlgWidgetComponet.h" +#include +#include + +QWBFZExcuteAlgProgramDialog::QWBFZExcuteAlgProgramDialog(QWidget *parent) + : QDialog(parent), + ui(new Ui::QWBFZExcuteAlgProgramDialogClass), + xmlfileSelectWidget(new FileSelectWidget(this)), + exefileSelectWidget(new FileSelectWidget(this)) +{ + ui->setupUi(this); + + // Ӳѡ + exefileSelectWidget->setParaName(u8"㷨ִexe"); + exefileSelectWidget->setParaChsName(u8"㷨ִexe"); + exefileSelectWidget->setDescription(u8"㷨ִexe"); + exefileSelectWidget->setDatatype(u8"string"); + exefileSelectWidget->setParaType(u8"Value"); + exefileSelectWidget->setComponentType(ComponentType::FileSelect); + exefileSelectWidget->initUI(); + + xmlfileSelectWidget->setParaName(u8"㷨xmlļ"); + xmlfileSelectWidget->setParaChsName(u8"㷨xmlļ"); + xmlfileSelectWidget->setDescription(u8"㷨xmlļ"); + xmlfileSelectWidget->setDatatype(u8"string"); + xmlfileSelectWidget->setParaType(u8"Value"); + xmlfileSelectWidget->setComponentType(ComponentType::FileSelect); + xmlfileSelectWidget->initUI(); + + + ui->verticalLayout_InParamsRegion->addWidget(exefileSelectWidget); + ui->verticalLayout_InParamsRegion->addWidget(xmlfileSelectWidget); + + // źŲ + QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onacceptButton_Clicked())); + QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(oncancelButton_Clicked())); + this->show(); +} + +QWBFZExcuteAlgProgramDialog::~QWBFZExcuteAlgProgramDialog() +{ + delete ui; +} + +void QWBFZExcuteAlgProgramDialog::onacceptButton_Clicked() +{ + QString xmlfilepath = xmlfileSelectWidget->getValue(); + QString exefilepath = exefileSelectWidget->getValue(); + + qDebug() <<"xmlpath :\t" << xmlfilepath; + qDebug() << "exepath :\t" << exefilepath; + + // ȡexeļļ· + QString exeDirPath = QFileInfo(exefilepath).absolutePath(); + qDebug() << "exedirpath :\t" << exeDirPath; + + // cmdȽexeļĿ¼ȻִexeļΪxmlļ· + QString cmdstr = QString("cd /d %1 && %2 %3").arg(exeDirPath).arg(exefilepath).arg(xmlfilepath); + qDebug() << "cmdstr :\t" << cmdstr; + // ִcmd + QProcess* process = new QProcess(this); + process->setProcessChannelMode(QProcess::MergedChannels); + + + // Windows APIǿƵ + process->setCreateProcessArgumentsModifier([](QProcess::CreateProcessArguments* args) { + args->flags |= CREATE_NEW_CONSOLE; // ¿̨ + args->startupInfo->wShowWindow = SW_SHOWNORMAL; // ʾ + args->startupInfo->dwFlags &= ~STARTF_USESTDHANDLES; // ñ׼ض[3,7](@ref) + }); + + + // ʵʱȡ + connect(process, &QProcess::readyRead, [=]() { + QString output = QString::fromLocal8Bit(process->readAll()); + qDebug() << "CMD Output:" << output; + }); + + // ó·Ͳ + process->start("cmd.exe", QStringList() << "/k" << cmdstr); + + // + connect(process, &QProcess::errorOccurred, [](QProcess::ProcessError error) { + qDebug() << "Error:" << error; + }); + +} + +void QWBFZExcuteAlgProgramDialog::oncancelButton_Clicked() +{ + this->close(); +} diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZExcuteAlgProgramDialog.h b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZExcuteAlgProgramDialog.h new file mode 100644 index 0000000..335a8c3 --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZExcuteAlgProgramDialog.h @@ -0,0 +1,38 @@ +#pragma once +#ifndef __QWBFZEXCUTEALGPROGRAMDIALOG_H__ +#define __QWBFZEXCUTEALGPROGRAMDIALOG_H__ + +#include + +namespace Ui { + class QWBFZExcuteAlgProgramDialogClass; +}; + + +class FileSelectWidget; + + +class QWBFZExcuteAlgProgramDialog : public QDialog +{ + Q_OBJECT + +public: + QWBFZExcuteAlgProgramDialog(QWidget *parent = nullptr); + ~QWBFZExcuteAlgProgramDialog(); + + +public slots: + void onacceptButton_Clicked(); // ȷť¼ + void oncancelButton_Clicked(); // ȡť¼ + +private: + Ui::QWBFZExcuteAlgProgramDialogClass* ui; + FileSelectWidget* xmlfileSelectWidget = nullptr; // xmlļѡ + FileSelectWidget* exefileSelectWidget = nullptr; // ļѡ +}; + + + + + +#endif \ No newline at end of file diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZExcuteAlgProgramDialog.ui b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZExcuteAlgProgramDialog.ui new file mode 100644 index 0000000..4944838 --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/QWBFZExcuteAlgProgramDialog.ui @@ -0,0 +1,32 @@ + + + QWBFZExcuteAlgProgramDialogClass + + + + 0 + 0 + 600 + 400 + + + + QWBFZExcuteAlgProgramDialog + + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/WBFZAlgComponetXmlParaseOperator.cpp b/Toolbox/KJ135WBJYAlgInterfaceToolbox/WBFZAlgComponetXmlParaseOperator.cpp new file mode 100644 index 0000000..ebb28e4 --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/WBFZAlgComponetXmlParaseOperator.cpp @@ -0,0 +1,240 @@ +#include "WBFZAlgComponetXmlParaseOperator.h" + +WBFZAlgComponetXmlParamenterItem::WBFZAlgComponetXmlParamenterItem(QDomElement* itemparameter, QObject* parent) :QObject(parent) +{ + if (nullptr == itemparameter) { + qDebug() << "itemparameter is nullptr."; + return; + } + + this->ParaName = itemparameter->firstChildElement("ParaName").isNull() ? QString() : itemparameter->firstChildElement("ParaName").text(); + this->ParaChsName = itemparameter->firstChildElement("ParaChsName").isNull() ? QString() : itemparameter->firstChildElement("ParaChsName").text(); + this->Description = itemparameter->firstChildElement("Description").isNull() ? QString() : itemparameter->firstChildElement("Description").text(); + this->Datatype = itemparameter->firstChildElement("DataType").isNull() ? QString() : itemparameter->firstChildElement("DataType").text(); + this->ParaType = itemparameter->firstChildElement("ParaType").isNull() ? QString() : itemparameter->firstChildElement("ParaType").text(); + this->ValueStr = itemparameter->firstChildElement("ParaValue").isNull() ? QString() : itemparameter->firstChildElement("ParaValue").text(); +} + +WBFZAlgComponetXmlParamenterItem::~WBFZAlgComponetXmlParamenterItem() +{ +} + +WBFZAlgComponetXmlParaseOperator::WBFZAlgComponetXmlParaseOperator(QObject* parent) :QObject(parent) +{ +} + +WBFZAlgComponetXmlParaseOperator::~WBFZAlgComponetXmlParaseOperator() +{ +} + +void WBFZAlgComponetXmlParaseOperator::loadXmlFile(const QString& fileName) +{ + this->xmlFilePath = fileName; + this->parseXmlFile(); +} + +void WBFZAlgComponetXmlParaseOperator::writeXmlFile(const QString& formatfilepath, QString outfilepath, QString workspace, QMap inputParamslist) +{ + // ģxmlļ + QFile inputFile(formatfilepath); + if (!inputFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + qDebug() << "Failed to open input XML file."; + return; + } + // QDomDocument + QDomDocument doc; + if (!doc.setContent(&inputFile)) { + qDebug() << "Failed to parse input XML file."; + inputFile.close(); + return; + } + // رļ + inputFile.close(); + + // ޸Ĺռ· + QDomElement root = doc.documentElement(); + QDomNodeList workspacePathNodes = root.elementsByTagName("WorkSpace"); + if (workspacePathNodes.count() > 0) { + QDomElement workspacePathElement = workspacePathNodes.at(0).toElement(); + workspacePathElement.firstChild().setNodeValue(workspace); + } + else { + qDebug() << "WorkspacePath not found."; + return; + } + + // ޸InputǩµParamǩµParaValueǩ + QDomNodeList InputsNodes = root.elementsByTagName("Inputs"); + if (InputsNodes.count() > 0) { + QDomElement InputsElement = InputsNodes.at(0).toElement(); + QDomNodeList parameterNodes = InputsElement.elementsByTagName("Parameter"); + for (int i = 0; i < parameterNodes.count(); ++i) { + QDomElement parameterElement = parameterNodes.at(i).toElement(); + QString paraName = parameterElement.firstChildElement("ParaName").text(); + if (inputParamslist.contains(paraName)) { + QDomNodeList valueNodes = parameterElement.elementsByTagName("ParaValue"); + if (valueNodes.count() > 0) { + valueNodes.at(0).firstChild().setNodeValue(inputParamslist.value(paraName)); + } + } + } + } + else { + qDebug() << "Inputs not found."; + return; + } + // 7. ޸ĺXMLļ + QFile outputFile(outfilepath); + if (!outputFile.open(QIODevice::WriteOnly | QIODevice::Text)) { + qDebug() << "Failed to open output XML file."; + return; + } + // ޸ĺдļ + QTextStream out(&outputFile); + out.setCodec("UTF-8"); + doc.save(out, 4); // 4ʾ + outputFile.close(); + qDebug() << "XML file written successfully."; + + + + +} + + +void WBFZAlgComponetXmlParaseOperator::parseXmlFile() +{ + // 1. Load the XML file + QFile file(xmlFilePath); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + qDebug() << "Failed to open XML file."; + return; + } + // 2. Create a QDomDocument object + QDomDocument doc; + if (!doc.setContent(&file)) { + qDebug() << "Failed to parse XML file."; + file.close(); + return; + } + // 3. Close the file + file.close(); + // 4. Get the root element + QDomElement root = doc.documentElement(); + // 5. Get the child elements of the root + QDomNodeList childNodes = root.childNodes(); + // 6. get the workspace path node + QDomNodeList workspacePathNodes = root.elementsByTagName("WorkSpace"); + if (workspacePathNodes.count() > 0) { + QDomElement workspacePathElement = workspacePathNodes.at(0).toElement(); + this->workSpacePath = workspacePathElement.text(); + } + else { + qDebug() << "WorkspacePath not found."; + return; + } + // 7. get Root/AlgCompt/Inputs µParameterӽڵ + QDomNodeList InputsNodes = root.elementsByTagName("Inputs"); + QDomNodeList parameterNodes = InputsNodes.at(0).toElement().elementsByTagName("Parameter"); + if (parameterNodes.count() > 0) { + for (int i = 0; i < parameterNodes.count(); ++i) { + QDomElement parameterElement = parameterNodes.at(i).toElement(); + WBFZAlgComponetXmlParamenterItem* item = new WBFZAlgComponetXmlParamenterItem(¶meterElement,this); + this->ParameterList.append(item); + qDebug() << "read Parameter Name:" << item->getParaName(); + if (item->getParaName().isEmpty()) { + QMessageBox::warning(nullptr, u8"", u8"Ϊ,xmlļʽ"); + qDebug() << "read Parameter Name Error:" << item->getParaName(); + return; + } + } + } + else { + qDebug() << "Parameter not found."; + return; + } +} + +void WBFZAlgComponetXmlParaseOperator::displayParsedData() +{ +} + +QString WBFZAlgComponetXmlParaseOperator::getWorkSpacePath() const +{ + return this->workSpacePath; +} + +void WBFZAlgComponetXmlParaseOperator::setWorkSpacePath(const QString& path) +{ + this->workSpacePath = path; +} + +QList WBFZAlgComponetXmlParaseOperator::getParameterList() const +{ + return ParameterList; +} + +void WBFZAlgComponetXmlParaseOperator::setParameterList(const QList& list) +{ + this->ParameterList = list; +} + +QString WBFZAlgComponetXmlParamenterItem::getParaName() const +{ + return this->ParaName; +} + +void WBFZAlgComponetXmlParamenterItem::setParaName(const QString& name) +{ + this->ParaName = name; +} + +QString WBFZAlgComponetXmlParamenterItem::getParaChsName() const +{ + return this->ParaChsName; +} + +void WBFZAlgComponetXmlParamenterItem::setParaChsName(const QString& name) +{ + this->ParaChsName = name; +} + +QString WBFZAlgComponetXmlParamenterItem::getDescription() const +{ + return this->Description; +} + +void WBFZAlgComponetXmlParamenterItem::setDescription(const QString& description) +{ + this->Description = description; +} + +QString WBFZAlgComponetXmlParamenterItem::getDatatype() const +{ + return this->Datatype; +} + +void WBFZAlgComponetXmlParamenterItem::setDatatype(const QString& datatype) +{ + this->Datatype = datatype; +} + +QString WBFZAlgComponetXmlParamenterItem::getParaType() const +{ + return this->ParaType; +} + +void WBFZAlgComponetXmlParamenterItem::setParaType(const QString& type) +{ + this->ParaType = type; +} + +QString WBFZAlgComponetXmlParamenterItem::getValueStr() const +{ + return this->ValueStr; +} + +void WBFZAlgComponetXmlParamenterItem::setValueStr(const QString& value) +{ + this->ValueStr = value; +} diff --git a/Toolbox/KJ135WBJYAlgInterfaceToolbox/WBFZAlgComponetXmlParaseOperator.h b/Toolbox/KJ135WBJYAlgInterfaceToolbox/WBFZAlgComponetXmlParaseOperator.h new file mode 100644 index 0000000..52fc953 --- /dev/null +++ b/Toolbox/KJ135WBJYAlgInterfaceToolbox/WBFZAlgComponetXmlParaseOperator.h @@ -0,0 +1,96 @@ +#pragma once +#ifndef __WBFZAlgComponetXmlParaseOperator_H__ +#define __WBFZAlgComponetXmlParaseOperator_H__ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "KJ135WBJYAlgWidgetComponet.h" // 㷨 + + +// 㷨xml +class WBFZAlgComponetXmlParamenterItem :QObject +{ + Q_OBJECT +public: + WBFZAlgComponetXmlParamenterItem(QDomElement* itemparameter,QObject* parent=nullptr); + ~WBFZAlgComponetXmlParamenterItem(); +private: + QString ParaName; // + QString ParaChsName;// + QString Description;// + + QString Datatype;// Value // + QString ParaType;// string + + QString ValueStr; + +public: + // getset + QString getParaName() const; + void setParaName(const QString& name); + QString getParaChsName() const; + void setParaChsName(const QString& name); + QString getDescription() const; + void setDescription(const QString& description); + QString getDatatype() const; + void setDatatype(const QString& datatype); + QString getParaType() const; + void setParaType(const QString& type); + QString getValueStr() const; + void setValueStr(const QString& value); + +}; + +// 㷨xml +class WBFZAlgComponetXmlParaseOperator :QObject +{ + Q_OBJECT +public: + WBFZAlgComponetXmlParaseOperator(QObject* parent = nullptr); + ~WBFZAlgComponetXmlParaseOperator(); + void loadXmlFile(const QString& fileName); + + void writeXmlFile(const QString& formatfilepath, QString outfilepath,QString workspace, QMap inputParamslist); + + + +private: + void parseXmlFile(); + void displayParsedData(); + +private: + QString workSpacePath; + QString xmlFilePath; +private:// ļṹ + QDomDocument doc; // xmlĵ + QDomElement rootElement; // ڵ + QDomElement workSpaceElement; // ռڵ + QList ParameterList; // б + +public: + QString getWorkSpacePath() const;// { return this->workSpacePath; } // ȡռ· + void setWorkSpacePath(const QString& path);// { this->workSpacePath = path; } // ùռ· + QList getParameterList() const; // { return this->ParameterList; } // ȡб + void setParameterList(const QList& list); //{ this->ParameterList = list; } // òб + + +}; + + + +#endif// __WBFZAlgComponetXmlParaseOperator_H__ + diff --git a/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.ui b/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.ui index 79f3686..3df8e20 100644 --- a/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.ui +++ b/Toolbox/SimulationSARTool/SimulationSAR/QSimulationBPImage.ui @@ -45,7 +45,7 @@ - D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\GF3_Simulation.xml + D:\FZSimulation\bak\LT1AB_FZ\Input01\tempEcho\LT1B_Simulation.xml @@ -102,7 +102,7 @@ - D:\Programme\vs2022\RasterMergeTest\simulationData\demdataset\demxyz.bin + D:\FZSimulation\bak\LT1AB_FZ\TBImage\img_XYZ.dat @@ -156,7 +156,7 @@ - D:\Programme\vs2022\RasterMergeTest\LAMPCAE_SCANE-all-scane\BPImage\GF3BPImage + D:\FZSimulation\bak\LT1AB_FZ\TBImage\TPImage\LT1A_Image diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.cpp b/Toolbox/SimulationSARTool/SimulationSARTool.cpp index 0065394..d937bd1 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.cpp +++ b/Toolbox/SimulationSARTool/SimulationSARTool.cpp @@ -39,7 +39,7 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi #ifdef __SIMULATIONSARTOOL__SARSATALLITESIMULATIONWORKFLOW__H__ - initSimulationSARToolSARSateSimulationWorkflow(toolbox); + // initSimulationSARToolSARSateSimulationWorkflow(toolbox); #endif diff --git a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj index 6c19a14..562d754 100644 --- a/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj +++ b/Toolbox/SimulationSARTool/SimulationSARTool.vcxproj @@ -134,7 +134,7 @@ compute_86,sm_86 - cufft.lib;%(AdditionalDependencies);cudart.lib;cudadevrt.lib + cufft.lib;cudart.lib;cudadevrt.lib;%(AdditionalDependencies) diff --git a/qss样式表/QSS-master.zip b/qss样式表/QSS-master.zip new file mode 100644 index 0000000..22f95b4 Binary files /dev/null and b/qss样式表/QSS-master.zip differ diff --git a/qss样式表/QSS-master/QSS/AMOLED.qss b/qss样式表/QSS-master/QSS/AMOLED.qss new file mode 100644 index 0000000..0083acb --- /dev/null +++ b/qss样式表/QSS-master/QSS/AMOLED.qss @@ -0,0 +1,576 @@ +/* +AMOLED Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 01/10/2021, 15:49. +Available at: https://github.com/GTRONICK/QSS/blob/master/AMOLED.qss +*/ +QMainWindow { + background-color:#000000; +} +QDialog { + background-color:#000000; +} +QColorDialog { + background-color:#000000; +} +QTextEdit { + background-color:#000000; + color: #a9b7c6; +} +QPlainTextEdit { + selection-background-color:#f39c12; + background-color:#000000; + border: 1px solid #FF00FF; + color: #a9b7c6; +} +QPushButton{ + border: 1px transparent; + color: #a9b7c6; + padding: 2px; + background-color: #000000; +} +QPushButton::default{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-width: 1px; + color: #a9b7c6; + padding: 2px; + background-color: #000000; +} +QPushButton:hover{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #FF00FF; + border-bottom-width: 1px; + border-bottom-radius: 6px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 2px; + background-color: #000000; +} +QPushButton:pressed{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #FF00FF; + border-bottom-width: 2px; + border-bottom-radius: 6px; + border-style: solid; + color: #e67e22; + padding-bottom: 1px; + background-color: #000000; +} +QPushButton:disabled{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 2px; + border-bottom-radius: 6px; + border-style: solid; + color: #808086; + padding-bottom: 1px; + background-color: #000000; +} +QToolButton { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-bottom-width: 1px; + border-style: solid; + color: #a9b7c6; + padding: 2px; + background-color: #000000; +} +QToolButton:hover{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-bottom-width: 2px; + border-bottom-radius: 6px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 1px; + background-color: #000000; +} +QLineEdit { + border-width: 1px; border-radius: 4px; + border-color: rgb(58, 58, 58); + border-style: inset; + padding: 0 8px; + color: #a9b7c6; + background:#000000; + selection-background-color:#007b50; + selection-color: #FFFFFF; +} +QLabel { + color: #a9b7c6; +} +QLCDNumber { + color: #e67e22; +} +QProgressBar { + text-align: center; + color: rgb(240, 240, 240); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; + background-color:#000000; +} +QProgressBar::chunk { + background-color: #e67e22; + border-radius: 5px; +} +QMenu{ + background-color:#000000; +} +QMenuBar { + background:rgb(0, 0, 0); + color: #a9b7c6; +} +QMenuBar::item { + spacing: 3px; + padding: 1px 4px; + background: transparent; +} +QMenuBar::item:selected { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-bottom-width: 1px; + border-bottom-radius: 6px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 0px; + background-color: #000000; +} +QMenu::item:selected { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: #e67e22; + border-bottom-color: transparent; + border-left-width: 2px; + color: #FFFFFF; + padding-left:15px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; + background-color:#000000; +} +QMenu::item { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + border-style: solid; + color: #a9b7c6; + padding-left:17px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; + background-color:#000000; +} +QTabWidget { + color:rgb(0,0,0); + background-color:#000000; +} +QTabWidget::pane { + border-color: rgb(77,77,77); + background-color:#000000; + border-style: solid; + border-width: 1px; + border-radius: 6px; +} +QTabBar::tab { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + border-style: solid; + color: #808086; + padding: 3px; + margin-left:3px; + background-color:#000000; +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-bottom-width: 2px; + border-style: solid; + color: #FFFFFF; + padding-left: 3px; + padding-bottom: 2px; + margin-left:3px; + background-color:#000000; +} + +QCheckBox { + color: #a9b7c6; + padding: 2px; +} +QCheckBox:disabled { + color: #808086; + padding: 2px; +} + +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: rgb(87, 97, 106); + background-color:#000000; +} +QCheckBox::indicator:checked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #e67e22; + color: #a9b7c6; + background-color: #e67e22; +} +QCheckBox::indicator:unchecked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #e67e22; + color: #a9b7c6; + background-color: transparent; +} +QRadioButton { + color: #a9b7c6; + background-color:#000000; + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #e67e22; + color: #a9b7c6; + background-color: #e67e22; +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #e67e22; + color: #a9b7c6; + background-color: transparent; +} +QStatusBar { + color:#34e8eb; +} +QSpinBox { + color: #a9b7c6; + background-color:#000000; +} +QDoubleSpinBox { + color: #a9b7c6; + background-color:#000000; +} +QTimeEdit { + color: #a9b7c6; + background-color:#000000; +} +QDateTimeEdit { + color: #a9b7c6; + background-color:#000000; +} +QDateEdit { + color: #a9b7c6; + background-color:#000000; +} +QComboBox { + color: #a9b7c6; + background: #1e1d23; +} +QComboBox:editable { + background: #1e1d23; + color: #a9b7c6; + selection-background-color:#000000; +} +QComboBox QAbstractItemView { + color: #a9b7c6; + background: #1e1d23; + selection-color: #FFFFFF; + selection-background-color:#000000; +} +QComboBox:!editable:on, QComboBox::drop-down:editable:on { + color: #a9b7c6; + background: #1e1d23; +} +QFontComboBox { + color: #a9b7c6; + background-color:#000000; +} +QToolBox { + color: #a9b7c6; + background-color:#000000; +} +QToolBox::tab { + color: #a9b7c6; + background-color:#000000; +} +QToolBox::tab:selected { + color: #FFFFFF; + background-color:#000000; +} +QScrollArea { + color: #FFFFFF; + background-color:#000000; +} +QSlider::groove:horizontal { + height: 5px; + background: #e67e22; +} +QSlider::groove:vertical { + width: 5px; + background: #e67e22; +} +QSlider::handle:horizontal { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f); + border: 1px solid #5c5c5c; + width: 14px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: qlineargradient(x1:1, y1:1, x2:0, y2:0, stop:0 #b4b4b4, stop:1 #8f8f8f); + border: 1px solid #5c5c5c; + height: 14px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal { + background: white; +} +QSlider::add-page:vertical { + background: white; +} +QSlider::sub-page:horizontal { + background: #e67e22; +} +QSlider::sub-page:vertical { + background: #e67e22; +} +QScrollBar:horizontal { + max-height: 20px; + background: rgb(0,0,0); + border: 1px transparent grey; + margin: 0px 20px 0px 20px; +} +QScrollBar::handle:horizontal { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + border-style: solid; + border-width: 1px; + border-color: rgb(0,0,0); + min-width: 25px; +} +QScrollBar::handle:horizontal:hover { + background: rgb(230, 126, 34); + border-style: solid; + border-width: 1px; + border-color: rgb(0,0,0); + min-width: 25px; +} +QScrollBar::add-line:horizontal { + border: 1px solid; + border-color: rgb(0,0,0); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:hover { + border: 1px solid; + border-color: rgb(0,0,0); + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:pressed { + border: 1px solid; + border-color: grey; + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal { + border: 1px solid; + border-color: rgb(0,0,0); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:hover { + border: 1px solid; + border-color: rgb(0,0,0); + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:pressed { + border: 1px solid; + border-color: grey; + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::left-arrow:horizontal { + border: 1px transparent grey; + border-radius: 3px; + width: 6px; + height: 6px; + background: rgb(0,0,0); +} +QScrollBar::right-arrow:horizontal { + border: 1px transparent grey; + border-radius: 3px; + width: 6px; + height: 6px; + background: rgb(0,0,0); +} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} +QScrollBar:vertical { + max-width: 20px; + background: rgb(0,0,0); + border: 1px transparent grey; + margin: 20px 0px 20px 0px; +} +QScrollBar::add-line:vertical { + border: 1px solid; + border-color: rgb(0,0,0); + background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:hover { + border: 1px solid; + border-color: rgb(0,0,0); + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:pressed { + border: 1px solid; + border-color: grey; + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical { + border: 1px solid; + border-color: rgb(0,0,0); + background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:hover { + border: 1px solid; + border-color: rgb(0,0,0); + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:pressed { + border: 1px solid; + border-color: grey; + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: top; + subcontrol-origin: margin; +} + QScrollBar::handle:vertical { + background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + border-style: solid; + border-width: 1px; + border-color: rgb(0,0,0); + min-height: 25px; +} +QScrollBar::handle:vertical:hover { + background: rgb(230, 126, 34); + border-style: solid; + border-width: 1px; + border-color: rgb(0,0,0); + min-heigth: 25px; +} +QScrollBar::up-arrow:vertical { + border: 1px transparent grey; + border-radius: 3px; + width: 6px; + height: 6px; + background: rgb(0,0,0); +} +QScrollBar::down-arrow:vertical { + border: 1px transparent grey; + border-radius: 3px; + width: 6px; + height: 6px; + background: rgb(0,0,0); +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} diff --git a/qss样式表/QSS-master/QSS/Aqua.qss b/qss样式表/QSS-master/QSS/Aqua.qss new file mode 100644 index 0000000..cce4c77 --- /dev/null +++ b/qss样式表/QSS-master/QSS/Aqua.qss @@ -0,0 +1,559 @@ +/* +Aqua Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 22/01/2019, 07:55. +Available at: https://github.com/GTRONICK/QSS/blob/master/Aqua.qss +*/ +QMainWindow { + background-color:#ececec; +} +QTextEdit { + border-width: 1px; + border-style: solid; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QPlainTextEdit { + border-width: 1px; + border-style: solid; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QToolButton { + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QToolButton:hover{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(197, 197, 197), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(197, 197, 197)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QToolButton:pressed{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(142,142,142); +} +QPushButton{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QPushButton::default{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QPushButton:hover{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(197, 197, 197), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(197, 197, 197)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QPushButton:pressed{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(142,142,142); +} +QPushButton:disabled{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: #808086; + padding: 2px; + background-color: rgb(142,142,142); +} +QLineEdit { + border-width: 1px; border-radius: 4px; + border-style: solid; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QLabel { + color: #000000; +} +QLCDNumber { + color: rgb(0, 113, 255, 255); +} +QProgressBar { + text-align: center; + color: rgb(240, 240, 240); + border-width: 1px; + border-radius: 10px; + border-color: rgb(230, 230, 230); + border-style: solid; + background-color:rgb(207,207,207); +} +QProgressBar::chunk { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); + border-radius: 10px; +} +QMenuBar { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(207, 209, 207, 255), stop:1 rgba(230, 229, 230, 255)); +} +QMenuBar::item { + color: #000000; + spacing: 3px; + padding: 1px 4px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(207, 209, 207, 255), stop:1 rgba(230, 229, 230, 255)); +} + +QMenuBar::item:selected { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #FFFFFF; +} +QMenu::item:selected { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + border-bottom-color: transparent; + border-left-width: 2px; + color: #000000; + padding-left:15px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; +} +QMenu::item { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + color: #000000; + padding-left:17px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; +} +QTabWidget { + color:rgb(0,0,0); + background-color:#000000; +} +QTabWidget::pane { + border-color: rgb(223,223,223); + background-color:rgb(226,226,226); + border-style: solid; + border-width: 2px; + border-radius: 6px; +} +QTabBar::tab:first { + border-style: solid; + border-left-width:1px; + border-right-width:0px; + border-top-width:1px; + border-bottom-width:1px; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + color: #000000; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(255, 255, 255, 255)); +} +QTabBar::tab:last { + border-style: solid; + border-width:1px; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-right-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + color: #000000; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(255, 255, 255, 255)); +} +QTabBar::tab { + border-style: solid; + border-top-width:1px; + border-bottom-width:1px; + border-left-width:1px; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + color: #000000; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(255, 255, 255, 255)); +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + border-style: solid; + border-left-width:1px; + border-right-color: transparent; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + color: #FFFFFF; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} + +QTabBar::tab:selected, QTabBar::tab:first:selected, QTabBar::tab:hover { + border-style: solid; + border-left-width:1px; + border-bottom-width:1px; + border-top-width:1px; + border-right-color: transparent; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + color: #FFFFFF; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} + +QCheckBox { + color: #000000; + padding: 2px; +} +QCheckBox:disabled { + color: #808086; + padding: 2px; +} + +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: transparent; +} +QCheckBox::indicator:checked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #000000; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QCheckBox::indicator:unchecked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #000000; +} +QRadioButton { + color: 000000; + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #a9b7c6; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #a9b7c6; + background-color: transparent; +} +QStatusBar { + color:#027f7f; +} +QSpinBox { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QDoubleSpinBox { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QTimeEdit { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QDateTimeEdit { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QDateEdit { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} + +QToolBox { + color: #a9b7c6; + background-color:#000000; +} +QToolBox::tab { + color: #a9b7c6; + background-color:#000000; +} +QToolBox::tab:selected { + color: #FFFFFF; + background-color:#000000; +} +QScrollArea { + color: #FFFFFF; + background-color:#000000; +} +QSlider::groove:horizontal { + height: 5px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); +} +QSlider::groove:vertical { + width: 5px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); +} +QSlider::handle:horizontal { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + width: 12px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + height: 12px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal { + background: rgb(181,181,181); +} +QSlider::add-page:vertical { + background: rgb(181,181,181); +} +QSlider::sub-page:horizontal { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); +} +QSlider::sub-page:vertical { + background-color: qlineargradient(spread:pad, y1:0.5, x1:1, y2:0.5, x2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); +} +QScrollBar:horizontal { + max-height: 20px; + border: 1px transparent grey; + margin: 0px 20px 0px 20px; +} +QScrollBar:vertical { + max-width: 20px; + border: 1px transparent grey; + margin: 20px 0px 20px 0px; +} +QScrollBar::handle:horizontal { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + border-radius: 7px; + min-width: 25px; +} +QScrollBar::handle:horizontal:hover { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(147, 200, 200); + border-radius: 7px; + min-width: 25px; +} +QScrollBar::handle:vertical { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + border-radius: 7px; + min-height: 25px; +} +QScrollBar::handle:vertical:hover { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(147, 200, 200); + border-radius: 7px; + min-height: 25px; +} +QScrollBar::add-line:horizontal { + border: 2px transparent grey; + border-top-right-radius: 7px; + border-bottom-right-radius: 7px; + background: rgba(34, 142, 255, 255); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:pressed { + border: 2px transparent grey; + border-top-right-radius: 7px; + border-bottom-right-radius: 7px; + background: rgb(181,181,181); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical { + border: 2px transparent grey; + border-bottom-left-radius: 7px; + border-bottom-right-radius: 7px; + background: rgba(34, 142, 255, 255); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:pressed { + border: 2px transparent grey; + border-bottom-left-radius: 7px; + border-bottom-right-radius: 7px; + background: rgb(181,181,181); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal { + border: 2px transparent grey; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgba(34, 142, 255, 255); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:pressed { + border: 2px transparent grey; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(181,181,181); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical { + border: 2px transparent grey; + border-top-left-radius: 7px; + border-top-right-radius: 7px; + background: rgba(34, 142, 255, 255); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:pressed { + border: 2px transparent grey; + border-top-left-radius: 7px; + border-top-right-radius: 7px; + background: rgb(181,181,181); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::left-arrow:horizontal { + border: 1px transparent grey; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; + width: 6px; + height: 6px; + background: white; +} +QScrollBar::right-arrow:horizontal { + border: 1px transparent grey; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; + width: 6px; + height: 6px; + background: white; +} +QScrollBar::up-arrow:vertical { + border: 1px transparent grey; + border-top-left-radius: 3px; + border-top-right-radius: 3px; + width: 6px; + height: 6px; + background: white; +} +QScrollBar::down-arrow:vertical { + border: 1px transparent grey; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + width: 6px; + height: 6px; + background: white; +} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} diff --git a/qss样式表/QSS-master/QSS/ConsoleStyle.qss b/qss样式表/QSS-master/QSS/ConsoleStyle.qss new file mode 100644 index 0000000..af6c204 --- /dev/null +++ b/qss样式表/QSS-master/QSS/ConsoleStyle.qss @@ -0,0 +1,181 @@ +/* +Dark Console Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 24/05/2018, 17:12. +Available at: https://github.com/GTRONICK/QSS/blob/master/ConsoleStyle.qss +*/ +QWidget { + background-color:rgb(0, 0, 0); + color: rgb(240, 240, 240); + border-color: rgb(58, 58, 58); +} + +QPlainTextEdit { + background-color:rgb(0, 0, 0); + color: rgb(200, 200, 200); + selection-background-color: rgb(255, 153, 0); + selection-color: rgb(0, 0, 0); +} + +QTabWidget::pane { + border-top: 1px solid #000000; +} + +QTabBar::tab { + background-color:rgb(0, 0, 0); + border-style: outset; + border-width: 1px; + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-top-width: 0px; + border-style: solid; + color: rgb(255, 153, 0); + padding: 4px; +} + +QTabBar::tab:selected, QTabBar::tab:hover { + color: rgb(255, 255, 255); + background-color:rgb(0, 0, 0); + border-color:rgb(42, 42, 42); + margin-left: 0px; + margin-right: 0px; + border-bottom-right-radius:4px; + border-bottom-left-radius:4px; +} + +QTabBar::tab:last:selected { + background-color:rgb(0, 0, 0); + border-color:rgb(42, 42, 42); + margin-left: 0px; + margin-right: 0px; + border-bottom-right-radius:4px; + border-bottom-left-radius:4px; +} + +QTabBar::tab:!selected { + margin-bottom: 4px; + border-bottom-right-radius:4px; + border-bottom-left-radius:4px; +} + +QPushButton{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); +} + +QPushButton:hover{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-bottom-color: rgb(115, 115, 115); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(107, 107, 107, 255), stop:1 rgba(157, 157, 157, 255)); +} + +QPushButton:pressed{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(62, 62, 62, 255), stop:1 rgba(22, 22, 22, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); +} + +QPushButton:disabled{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(0, 0, 0); + padding: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(57, 57, 57, 255), stop:1 rgba(77, 77, 77, 255)); +} + +QLineEdit { + border-width: 1px; border-radius: 4px; + border-color: rgb(58, 58, 58); + border-style: inset; + padding: 0 8px; + color: rgb(255, 255, 255); + background:rgb(101, 101, 101); + selection-background-color: rgb(187, 187, 187); + selection-color: rgb(60, 63, 65); +} + +QProgressBar { + text-align: center; + color: rgb(255, 255, 255); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; +} + +QProgressBar::chunk { + background-color: qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(0, 200, 0, 255), stop:1 rgba(30, 230, 30, 255)); + border-radius: 10px; +} + +QMenuBar { + background:rgb(0, 0, 0); + color: rgb(255, 153, 0); +} + +QMenuBar::item { + spacing: 3px; + padding: 1px 4px; + background: transparent; +} + +QMenuBar::item:selected { + background:rgb(115, 115, 115); +} + +QMenu { + border-width: 2px; + border-radius: 10px; + border-color: rgb(255, 153, 0); + border-style: outset; +} + +QMenu::item { + spacing: 3px; + padding: 3px 15px; +} + +QMenu::item:selected { + spacing: 3px; + padding: 3px 15px; + background:rgb(115, 115, 115); + color:rgb(255, 255, 255); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; +} diff --git a/qss样式表/QSS-master/QSS/ElegantDark.qss b/qss样式表/QSS-master/QSS/ElegantDark.qss new file mode 100644 index 0000000..49d2b0b --- /dev/null +++ b/qss样式表/QSS-master/QSS/ElegantDark.qss @@ -0,0 +1,196 @@ +/* +ElegantDark Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 17/04/2018 +Available at: https://github.com/GTRONICK/QSS/blob/master/ElegantDark.qss +*/ +QMainWindow { + background-color:rgb(82, 82, 82); +} +QTextEdit { + background-color:rgb(42, 42, 42); + color: rgb(0, 255, 0); +} +QPushButton{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); +} +QPushButton:hover{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-bottom-color: rgb(115, 115, 115); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(107, 107, 107, 255), stop:1 rgba(157, 157, 157, 255)); +} +QPushButton:pressed{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(62, 62, 62, 255), stop:1 rgba(22, 22, 22, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); +} +QPushButton:disabled{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(0, 0, 0); + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(57, 57, 57, 255), stop:1 rgba(77, 77, 77, 255)); +} +QLineEdit { + border-width: 1px; border-radius: 4px; + border-color: rgb(58, 58, 58); + border-style: inset; + padding: 0 8px; + color: rgb(255, 255, 255); + background:rgb(100, 100, 100); + selection-background-color: rgb(187, 187, 187); + selection-color: rgb(60, 63, 65); +} +QLabel { + color:rgb(255,255,255); +} +QProgressBar { + text-align: center; + color: rgb(240, 240, 240); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; + background-color:rgb(77,77,77); +} +QProgressBar::chunk { + background-color: qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 255), stop:1 rgba(93, 103, 113, 255)); + border-radius: 5px; +} +QMenuBar { + background:rgb(82, 82, 82); +} +QMenuBar::item { + color:rgb(223,219,210); + spacing: 3px; + padding: 1px 4px; + background: transparent; +} + +QMenuBar::item:selected { + background:rgb(115, 115, 115); +} +QMenu::item:selected { + color:rgb(255,255,255); + border-width:2px; + border-style:solid; + padding-left:18px; + padding-right:8px; + padding-top:2px; + padding-bottom:3px; + background:qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 255), stop:1 rgba(93, 103, 113, 255)); + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; +} +QMenu::item { + color:rgb(223,219,210); + background-color:rgb(78,78,78); + padding-left:20px; + padding-top:4px; + padding-bottom:4px; + padding-right:10px; +} +QMenu{ + background-color:rgb(78,78,78); +} +QTabWidget { + color:rgb(0,0,0); + background-color:rgb(247,246,246); +} +QTabWidget::pane { + border-color: rgb(77,77,77); + background-color:rgb(101,101,101); + border-style: solid; + border-width: 1px; + border-radius: 6px; +} +QTabBar::tab { + padding:2px; + color:rgb(250,250,250); + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); + border-style: solid; + border-width: 2px; + border-top-right-radius:4px; + border-top-left-radius:4px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(95, 92, 93, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(95, 92, 93, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(95, 92, 93, 255)); + border-bottom-color: rgb(101,101,101); +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + background-color:rgb(101,101,101); + margin-left: 0px; + margin-right: 1px; +} +QTabBar::tab:!selected { + margin-top: 1px; + margin-right: 1px; +} +QCheckBox { + color:rgb(223,219,210); + padding: 2px; +} +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: rgb(87, 97, 106); + background-color:qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 150), stop:1 rgba(93, 103, 113, 150)); +} +QCheckBox::indicator:checked { + border-radius:4px; + border-style:solid; + border-width:1px; + border-color: rgb(180,180,180); + background-color:qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 255), stop:1 rgba(93, 103, 113, 255)); +} +QCheckBox::indicator:unchecked { + border-radius:4px; + border-style:solid; + border-width:1px; + border-color: rgb(87, 97, 106); + background-color:rgb(255,255,255); +} +QStatusBar { + color:rgb(240,240,240); +} diff --git a/qss样式表/QSS-master/QSS/LICENSE b/qss样式表/QSS-master/QSS/LICENSE new file mode 100644 index 0000000..868ac31 --- /dev/null +++ b/qss样式表/QSS-master/QSS/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Jaime Quiroga + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/qss样式表/QSS-master/QSS/MacOS.qss b/qss样式表/QSS-master/QSS/MacOS.qss new file mode 100644 index 0000000..9a98622 --- /dev/null +++ b/qss样式表/QSS-master/QSS/MacOS.qss @@ -0,0 +1,434 @@ +/* + * MacOS Style Sheet for QT Applications + * Author: Jaime A. Quiroga P. + * Company: GTRONICK + * Last updated: 25/12/2020, 23:10. + * Available at: https://github.com/GTRONICK/QSS/blob/master/MacOS.qss + */ +QMainWindow { + background-color:#ececec; +} +QPushButton, QToolButton, QCommandLinkButton{ + padding: 0 5px 0 5px; + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-right-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-bottom-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-width: 2px; + border-radius: 8px; + color: #616161; + font-weight: bold; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #fbfdfd, stop:0.5 #ffffff, stop:1 #fbfdfd); +} +QPushButton::default, QToolButton::default, QCommandLinkButton::default{ + border: 2px solid transparent; + color: #FFFFFF; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #84afe5, stop:1 #1168e4); +} +QPushButton:hover, QToolButton:hover, QCommandLinkButton:hover{ + color: #3d3d3d; +} +QPushButton:pressed, QToolButton:pressed, QCommandLinkButton:pressed{ + color: #aeaeae; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #ffffff, stop:0.5 #fbfdfd, stop:1 #ffffff); +} +QPushButton:disabled, QToolButton:disabled, QCommandLinkButton:disabled{ + color: #616161; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #dce7eb, stop:0.5 #e0e8eb, stop:1 #dee7ec); +} +QLineEdit, QTextEdit, QPlainTextEdit, QSpinBox, QDoubleSpinBox, QTimeEdit, QDateEdit, QDateTimeEdit { + border-width: 2px; + border-radius: 8px; + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + background-color: #f4f4f4; + color: #3d3d3d; +} +QLineEdit:focus, QTextEdit:focus, QPlainTextEdit:focus, QSpinBox:focus, QDoubleSpinBox:focus, QTimeEdit:focus, QDateEdit:focus, QDateTimeEdit:focus { + border-width: 2px; + border-radius: 8px; + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 #85b7e3, stop:1 #9ec1db); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #85b7e3, stop:1 #9ec1db); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #85b7e3, stop:1 #9ec1db); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 #85b7e3, stop:1 #9ec1db); + background-color: #f4f4f4; + color: #3d3d3d; +} +QLineEdit:disabled, QTextEdit:disabled, QPlainTextEdit:disabled, QSpinBox:disabled, QDoubleSpinBox:disabled, QTimeEdit:disabled, QDateEdit:disabled, QDateTimeEdit:disabled { + color: #b9b9b9; +} +QSpinBox::up-button, QDoubleSpinBox::up-button, QTimeEdit::up-button, QDateEdit::up-button, QDateTimeEdit::up-button { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 15px; + color: #272727; + border-left-width: 1px; + border-left-color: darkgray; + border-left-style: solid; + border-top-right-radius: 3px; + padding: 3px; +} +QSpinBox::down-button, QDoubleSpinBox::down-button, QTimeEdit::down-button, QDateEdit::down-button, QDateTimeEdit::down-button { + subcontrol-origin: padding; + subcontrol-position: bottom right; + width: 15px; + color: #272727; + border-left-width: 1px; + border-left-color: darkgray; + border-left-style: solid; + border-bottom-right-radius: 3px; + padding: 3px; +} +QSpinBox::up-button:pressed, QDoubleSpinBox::up-button:pressed, QTimeEdit::up-button:pressed, QDateEdit::up-button:pressed, QDateTimeEdit::up-button:pressed { + color: #aeaeae; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #ffffff, stop:0.5 #fbfdfd, stop:1 #ffffff); +} +QSpinBox::down-button:pressed, QDoubleSpinBox::down-button:pressed, QTimeEdit::down-button:pressed, QDateEdit::down-button:pressed, QDateTimeEdit::down-button:pressed { + color: #aeaeae; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #ffffff, stop:0.5 #fbfdfd, stop:1 #ffffff); +} +QSpinBox::up-button:hover, QDoubleSpinBox::up-button:hover, QTimeEdit::up-button:hover, QDateEdit::up-button:hover, QDateTimeEdit::up-button:hover { + color: #FFFFFF; + border-top-right-radius: 5px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #84afe5, stop:1 #1168e4); + +} +QSpinBox::down-button:hover, QDoubleSpinBox::down-button:hover, QTimeEdit::down-button:hover, QDateEdit::down-button:hover, QDateTimeEdit::down-button:hover { + color: #FFFFFF; + border-bottom-right-radius: 5px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #84afe5, stop:1 #1168e4); +} +QSpinBox::up-arrow, QDoubleSpinBox::up-arrow, QTimeEdit::up-arrow, QDateEdit::up-arrow, QDateTimeEdit::up-arrow { + image: url(/usr/share/icons/Adwaita/16x16/actions/go-up-symbolic.symbolic.png); +} +QSpinBox::down-arrow, QDoubleSpinBox::down-arrow, QTimeEdit::down-arrow, QDateEdit::down-arrow, QDateTimeEdit::down-arrow { + image: url(/usr/share/icons/Adwaita/16x16/actions/go-down-symbolic.symbolic.png); +} +QProgressBar { + max-height: 8px; + text-align: center; + font: italic bold 11px; + color: #3d3d3d; + border: 1px solid transparent; + border-radius:4px; + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #ddd5d5, stop:0.5 #dad3d3, stop:1 #ddd5d5); +} +QProgressBar::chunk { + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1); + border-radius: 4px; +} +QProgressBar:disabled { + color: #616161; +} +QProgressBar::chunk:disabled { + background-color: #aeaeae; +} +QSlider::groove { + border: 1px solid #bbbbbb; + background-color: #52595d; + border-radius: 4px; +} +QSlider::groove:horizontal { + height: 6px; +} +QSlider::groove:vertical { + width: 6px; +} +QSlider::handle:horizontal { + background: #ffffff; + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + width: 12px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: #ffffff; + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + height: 12px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page, QSlider::sub-page { + border: 1px transparent; + background-color: #52595d; + border-radius: 4px; +} +QSlider::add-page:horizontal { + background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #ddd5d5, stop:0.5 #dad3d3, stop:1 #ddd5d5); +} +QSlider::sub-page:horizontal { + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1); +} +QSlider::add-page:vertical { + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1); +} +QSlider::sub-page:vertical { + background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #ddd5d5, stop:0.5 #dad3d3, stop:1 #ddd5d5); +} +QSlider::add-page:horizontal:disabled, QSlider::sub-page:horizontal:disabled, QSlider::add-page:vertical:disabled, QSlider::sub-page:vertical:disabled { + background: #b9b9b9; +} +QComboBox, QFontComboBox { + border-width: 2px; + border-radius: 8px; + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #c1c9cf, stop:1 #d2d8dd); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd); + background-color: #f4f4f4; + color: #272727; + padding-left: 5px; +} +QComboBox:editable, QComboBox:!editable, QComboBox::drop-down:editable, QComboBox:!editable:on, QComboBox::drop-down:editable:on { + background: #ffffff; +} +QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 15px; + color: #272727; + border-left-width: 1px; + border-left-color: darkgray; + border-left-style: solid; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} +QComboBox::down-arrow { + image: url(/usr/share/icons/Adwaita/16x16/actions/go-down-symbolic.symbolic.png); /*Adawaita icon thene*/ +} + +QComboBox::down-arrow:on { + top: 1px; + left: 1px; +} +QComboBox QAbstractItemView { + border: 1px solid darkgray; + border-radius: 8px; + selection-background-color: #dadada; + selection-color: #272727; + color: #272727; + background: white; +} +QLabel, QCheckBox, QRadioButton { + color: #272727; +} +QCheckBox { + padding: 2px; +} +QCheckBox:disabled, QRadioButton:disabled { + color: #808086; + padding: 2px; +} + +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: transparent; +} +QCheckBox::indicator:checked { + image: url(/usr/share/icons/Adwaita/16x16/actions/object-select-symbolic.symbolic.png); + height: 15px; + width: 15px; + border-style:solid; + border-width: 1px; + border-color: #48a5fd; + color: #ffffff; + border-radius: 3px; + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #48a5fd, stop:0.5 #329cfb, stop:1 #48a5fd); +} +QCheckBox::indicator:unchecked { + + height: 15px; + width: 15px; + border-style:solid; + border-width: 1px; + border-color: #48a5fd; + border-radius: 3px; + background-color: #fbfdfa; +} +QLCDNumber { + color: #616161;; +} +QMenuBar { + background-color: #ececec; +} +QMenuBar::item { + color: #616161; + spacing: 3px; + padding: 1px 4px; + background-color: #ececec; +} + +QMenuBar::item:selected { + background-color: #dadada; + color: #3d3d3d; +} +QMenu { + background-color: #ececec; +} +QMenu::item:selected { + background-color: #dadada; + color: #3d3d3d; +} +QMenu::item { + color: #616161;; + background-color: #e0e0e0; +} +QTabWidget { + color:rgb(0,0,0); + background-color:#000000; +} +QTabWidget::pane { + border-color: #050a0e; + background-color: #e0e0e0; + border-width: 1px; + border-radius: 4px; + position: absolute; + top: -0.5em; + padding-top: 0.5em; +} + +QTabWidget::tab-bar { + alignment: center; +} + +QTabBar::tab { + border-bottom: 1px solid #c0c0c0; + padding: 3px; + color: #272727; + background-color: #fefefc; + margin-left:0px; +} +QTabBar::tab:!last { + border-right: 1px solid; + border-right-color: #c0c0c0; + border-bottom-color: #c0c0c0; +} +QTabBar::tab:first { + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; +} +QTabBar::tab:last { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + color: #FFFFFF; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #84afe5, stop:1 #1168e4); +} +QRadioButton::indicator { + height: 14px; + width: 14px; + border-style:solid; + border-radius:7px; + border-width: 1px; +} +QRadioButton::indicator:checked { + border-color: #48a5fd; + background-color: qradialgradient(cx:0.5, cy:0.5, radius:0.4,fx:0.5, fy:0.5, stop:0 #ffffff, stop:0.5 #ffffff, stop:0.6 #48a5fd, stop:1 #48a5fd); +} +QRadioButton::indicator:!checked { + border-color: #a9b7c6; + background-color: #fbfdfa; +} +QStatusBar { + color:#027f7f; +} + +QDial { + background: #16a085; +} + +QToolBox { + color: #a9b7c6; + background-color: #222b2e; +} +QToolBox::tab { + color: #a9b7c6; + background-color:#222b2e; +} +QToolBox::tab:selected { + color: #FFFFFF; + background-color:#222b2e; +} +QScrollArea { + color: #FFFFFF; + background-color:#222b2e; +} + +QScrollBar:horizontal { + max-height: 10px; + border: 1px transparent grey; + margin: 0px 20px 0px 20px; + background: transparent; +} +QScrollBar:vertical { + max-width: 10px; + border: 1px transparent grey; + margin: 20px 0px 20px 0px; + background: transparent; +} +QScrollBar::handle:vertical, QScrollBar::handle:horizontal { + background: #52595d; + border-style: transparent; + border-radius: 4px; + min-height: 25px; +} +QScrollBar::handle:horizontal:hover, QScrollBar::handle:vertical:hover { + background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1); +} +QScrollBar::add-line, QScrollBar::sub-line { + border: 2px transparent grey; + border-radius: 4px; + subcontrol-origin: margin; + background: #b9b9b9; +} +QScrollBar::add-line:horizontal { + width: 20px; + subcontrol-position: right; +} +QScrollBar::add-line:vertical { + height: 20px; + subcontrol-position: bottom; +} +QScrollBar::sub-line:horizontal { + width: 20px; + subcontrol-position: left; +} +QScrollBar::sub-line:vertical { + height: 20px; + subcontrol-position: top; +} +QScrollBar::add-line:vertical:pressed, QScrollBar::add-line:horizontal:pressed, QScrollBar::sub-line:horizontal:pressed, QScrollBar::sub-line:vertical:pressed { + background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1); +} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal, QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} +QScrollBar::up-arrow:vertical { + image: url(/usr/share/icons/Adwaita/16x16/actions/go-up-symbolic.symbolic.png); +} +QScrollBar::down-arrow:vertical { + image: url(/usr/share/icons/Adwaita/16x16/actions/go-down-symbolic.symbolic.png); +} +QScrollBar::left-arrow:horizontal { + image: url(/usr/share/icons/Adwaita/16x16/actions/go-previous-symbolic.symbolic.png); +} +QScrollBar::right-arrow:horizontal { + image: url(/usr/share/icons/Adwaita/16x16/actions/go-next-symbolic.symbolic.png); +} diff --git a/qss样式表/QSS-master/QSS/ManjaroMix.qss b/qss样式表/QSS-master/QSS/ManjaroMix.qss new file mode 100644 index 0000000..92301a5 --- /dev/null +++ b/qss样式表/QSS-master/QSS/ManjaroMix.qss @@ -0,0 +1,531 @@ +/* +ManjaroMix Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 25/02/2020, 15:42. +Available at: https://github.com/GTRONICK/QSS/blob/master/ManjaroMix.qss +*/ +QMainWindow { + background-color:#151a1e; +} +QCalendar { + background-color: #151a1e; +} +QTextEdit { + border-width: 1px; + border-style: solid; + border-color: #4fa08b; + background-color: #222b2e; + color: #d3dae3; +} +QPlainTextEdit { + border-width: 1px; + border-style: solid; + border-color: #4fa08b; + background-color: #222b2e; + color: #d3dae3; +} +QToolButton { + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: rgb(255,255,255); +} +QToolButton:hover{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(197, 197, 197), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(197, 197, 197)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QToolButton:pressed{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(142,142,142); +} +QPushButton{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: #151a1e; +} +QPushButton::default{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #FFFFFF; + padding: 2px; + background-color: #151a1e;; +} +QPushButton:hover{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: #1c1f1f; +} +QPushButton:pressed{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: #2c2f2f; +} +QPushButton:disabled{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: #808086; + padding: 2px; + background-color: rgb(142,142,142); +} +QLineEdit { + border-width: 1px; + border-style: solid; + border-color: #4fa08b; + background-color: #222b2e; + color: #d3dae3; +} +QLabel { + color: #d3dae3; +} +QLCDNumber { + color: #4d9b87; +} +QProgressBar { + text-align: center; + color: #d3dae3; + border-radius: 10px; + border-color: transparent; + border-style: solid; + background-color: #52595d; +} +QProgressBar::chunk { + background-color: #214037 ; + border-radius: 10px; +} +QMenuBar { + background-color: #151a1e; +} +QMenuBar::item { + color: #d3dae3; + spacing: 3px; + padding: 1px 4px; + background-color: #151a1e; +} + +QMenuBar::item:selected { + background-color: #252a2e; + color: #FFFFFF; +} +QMenu { + background-color: #151a1e; +} +QMenu::item:selected { + background-color: #252a2e; + color: #FFFFFF; +} +QMenu::item { + color: #d3dae3; + background-color: #151a1e; +} +QTabWidget { + color:rgb(0,0,0); + background-color:#000000; +} +QTabWidget::pane { + border-color: #050a0e; + background-color: #1e282c; + border-style: solid; + border-width: 1px; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; +} +QTabBar::tab:first { + border-style: solid; + border-left-width:1px; + border-right-width:0px; + border-top-width:1px; + border-bottom-width:0px; + border-top-color: #050a0e; + border-left-color: #050a0e; + border-bottom-color: #050a0e; + border-top-left-radius: 4px; + color: #d3dae3; + padding: 3px; + margin-left:0px; + background-color: #151a1e; +} +QTabBar::tab:last { + border-style: solid; + border-top-width:1px; + border-left-width:1px; + border-right-width:1px; + border-bottom-width:0px; + border-color: #050a0e; + border-top-right-radius: 4px; + color: #d3dae3; + padding: 3px; + margin-left:0px; + background-color: #151a1e; +} +QTabBar::tab { + border-style: solid; + border-top-width:1px; + border-bottom-width:0px; + border-left-width:1px; + border-top-color: #050a0e; + border-left-color: #050a0e; + border-bottom-color: #050a0e; + color: #d3dae3; + padding: 3px; + margin-left:0px; + background-color: #151a1e; +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + border-style: solid; + border-left-width:1px; + border-bottom-width:0px; + border-right-color: transparent; + border-top-color: #050a0e; + border-left-color: #050a0e; + border-bottom-color: #050a0e; + color: #FFFFFF; + padding: 3px; + margin-left:0px; + background-color: #1e282c; +} + +QTabBar::tab:selected, QTabBar::tab:first:selected, QTabBar::tab:hover { + border-style: solid; + border-left-width:1px; + border-bottom-width:0px; + border-top-width:1px; + border-right-color: transparent; + border-top-color: #050a0e; + border-left-color: #050a0e; + border-bottom-color: #050a0e; + color: #FFFFFF; + padding: 3px; + margin-left:0px; + background-color: #1e282c; +} + +QCheckBox { + color: #d3dae3; + padding: 2px; +} +QCheckBox:disabled { + color: #808086; + padding: 2px; +} + +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: transparent; +} +QCheckBox::indicator:checked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #4fa08b; + color: #000000; + background-color: qradialgradient(cx:0.4, cy:0.4, radius: 1.5,fx:0, fy:0, stop:0 #1e282c, stop:0.3 #1e282c, stop:0.4 #4fa08b, stop:0.5 #1e282c, stop:1 #1e282c); +} +QCheckBox::indicator:unchecked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #4fa08b; + color: #000000; +} +QRadioButton { + color: #d3dae3; + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #4fa08b; + color: #a9b7c6; + background-color: qradialgradient(cx:0.5, cy:0.5, radius:0.4,fx:0.5, fy:0.5, stop:0 #4fa08b, stop:1 #1e282c); +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #4fa08b; + color: #a9b7c6; + background-color: transparent; +} +QStatusBar { + color:#027f7f; +} +QSpinBox { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QDoubleSpinBox { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QTimeEdit { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QDateTimeEdit { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QDateEdit { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QFontComboBox { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QComboBox { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} + +QDial { + background: #16a085; +} + +QToolBox { + color: #a9b7c6; + background-color: #222b2e; +} +QToolBox::tab { + color: #a9b7c6; + background-color:#222b2e; +} +QToolBox::tab:selected { + color: #FFFFFF; + background-color:#222b2e; +} +QScrollArea { + color: #FFFFFF; + background-color:#222b2e; +} +QSlider::groove:horizontal { + height: 5px; + background-color: #52595d; +} +QSlider::groove:vertical { + width: 5px; + background-color: #52595d; +} +QSlider::handle:horizontal { + background: #1a2224; + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + width: 12px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: #1a2224; + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + height: 12px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal { + background: #52595d; +} +QSlider::add-page:vertical { + background: #52595d; +} +QSlider::sub-page:horizontal { + background-color: #15433a; +} +QSlider::sub-page:vertical { + background-color: #15433a; +} +QScrollBar:horizontal { + max-height: 10px; + border: 1px transparent grey; + margin: 0px 20px 0px 20px; + background: transparent; +} +QScrollBar:vertical { + max-width: 10px; + border: 1px transparent grey; + margin: 20px 0px 20px 0px; + background: transparent; +} +QScrollBar::handle:horizontal { + background: #52595d; + border-style: transparent; + border-radius: 4px; + min-width: 25px; +} +QScrollBar::handle:horizontal:hover { + background: #58a492; + border-style: transparent; + border-radius: 4px; + min-width: 25px; +} +QScrollBar::handle:vertical { + background: #52595d; + border-style: transparent; + border-radius: 4px; + min-height: 25px; +} +QScrollBar::handle:vertical:hover { + background: #58a492; + border-style: transparent; + border-radius: 4px; + min-height: 25px; +} +QScrollBar::add-line:horizontal { + border: 2px transparent grey; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + background: #15433a; + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:pressed { + border: 2px transparent grey; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(181,181,181); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical { + border: 2px transparent grey; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: #15433a; + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:pressed { + border: 2px transparent grey; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(181,181,181); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal { + border: 2px transparent grey; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + background: #15433a; + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:pressed { + border: 2px transparent grey; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + background: rgb(181,181,181); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical { + border: 2px transparent grey; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + background: #15433a; + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:pressed { + border: 2px transparent grey; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + background: rgb(181,181,181); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} + +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} diff --git a/qss样式表/QSS-master/QSS/MaterialDark.qss b/qss样式表/QSS-master/QSS/MaterialDark.qss new file mode 100644 index 0000000..c5a94aa --- /dev/null +++ b/qss样式表/QSS-master/QSS/MaterialDark.qss @@ -0,0 +1,390 @@ +/* +Material Dark Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Inspired on https://github.com/jxfwinter/qt-material-stylesheet +Company: GTRONICK +Last updated: 04/12/2018, 15:00. +Available at: https://github.com/GTRONICK/QSS/blob/master/MaterialDark.qss +*/ +QMainWindow { + background-color:#1e1d23; +} +QDialog { + background-color:#1e1d23; +} +QColorDialog { + background-color:#1e1d23; +} +QTextEdit { + background-color:#1e1d23; + color: #a9b7c6; +} +QPlainTextEdit { + selection-background-color:#007b50; + background-color:#1e1d23; + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-width: 1px; + color: #a9b7c6; +} +QPushButton{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-width: 1px; + border-style: solid; + color: #a9b7c6; + padding: 2px; + background-color: #1e1d23; +} +QPushButton::default{ + border-style: inset; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #04b97f; + border-width: 1px; + color: #a9b7c6; + padding: 2px; + background-color: #1e1d23; +} +QToolButton { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #04b97f; + border-bottom-width: 1px; + border-style: solid; + color: #a9b7c6; + padding: 2px; + background-color: #1e1d23; +} +QToolButton:hover{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #37efba; + border-bottom-width: 2px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 1px; + background-color: #1e1d23; +} +QPushButton:hover{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #37efba; + border-bottom-width: 1px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 2px; + background-color: #1e1d23; +} +QPushButton:pressed{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #37efba; + border-bottom-width: 2px; + border-style: solid; + color: #37efba; + padding-bottom: 1px; + background-color: #1e1d23; +} +QPushButton:disabled{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #808086; + border-bottom-width: 2px; + border-style: solid; + color: #808086; + padding-bottom: 1px; + background-color: #1e1d23; +} +QLineEdit { + border-width: 1px; border-radius: 4px; + border-color: rgb(58, 58, 58); + border-style: inset; + padding: 0 8px; + color: #a9b7c6; + background:#1e1d23; + selection-background-color:#007b50; + selection-color: #FFFFFF; +} +QLabel { + color: #a9b7c6; +} +QLCDNumber { + color: #37e6b4; +} +QProgressBar { + text-align: center; + color: rgb(240, 240, 240); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; + background-color:#1e1d23; +} +QProgressBar::chunk { + background-color: #04b97f; + border-radius: 5px; +} +QMenuBar { + background-color: #1e1d23; +} +QMenuBar::item { + color: #a9b7c6; + spacing: 3px; + padding: 1px 4px; + background: #1e1d23; +} + +QMenuBar::item:selected { + background:#1e1d23; + color: #FFFFFF; +} +QMenu::item:selected { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: #04b97f; + border-bottom-color: transparent; + border-left-width: 2px; + color: #FFFFFF; + padding-left:15px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; + background-color: #1e1d23; +} +QMenu::item { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + border-style: solid; + color: #a9b7c6; + padding-left:17px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; + background-color: #1e1d23; +} +QMenu{ + background-color:#1e1d23; +} +QTabWidget { + color:rgb(0,0,0); + background-color:#1e1d23; +} +QTabWidget::pane { + border-color: rgb(77,77,77); + background-color:#1e1d23; + border-style: solid; + border-width: 1px; + border-radius: 6px; +} +QTabBar::tab { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + border-style: solid; + color: #808086; + padding: 3px; + margin-left:3px; + background-color: #1e1d23; +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #04b97f; + border-bottom-width: 2px; + border-style: solid; + color: #FFFFFF; + padding-left: 3px; + padding-bottom: 2px; + margin-left:3px; + background-color: #1e1d23; +} + +QCheckBox { + color: #a9b7c6; + padding: 2px; +} +QCheckBox:disabled { + color: #808086; + padding: 2px; +} + +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: rgb(87, 97, 106); + background-color:#1e1d23; +} +QCheckBox::indicator:checked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #04b97f; + color: #a9b7c6; + background-color: #04b97f; +} +QCheckBox::indicator:unchecked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #04b97f; + color: #a9b7c6; + background-color: transparent; +} +QRadioButton { + color: #a9b7c6; + background-color: #1e1d23; + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #04b97f; + color: #a9b7c6; + background-color: #04b97f; +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #04b97f; + color: #a9b7c6; + background-color: transparent; +} +QStatusBar { + color:#027f7f; +} +QSpinBox { + color: #a9b7c6; + background-color: #1e1d23; +} +QDoubleSpinBox { + color: #a9b7c6; + background-color: #1e1d23; +} +QTimeEdit { + color: #a9b7c6; + background-color: #1e1d23; +} +QDateTimeEdit { + color: #a9b7c6; + background-color: #1e1d23; +} +QDateEdit { + color: #a9b7c6; + background-color: #1e1d23; +} +QComboBox { + color: #a9b7c6; + background: #1e1d23; +} +QComboBox:editable { + background: #1e1d23; + color: #a9b7c6; + selection-background-color: #1e1d23; +} +QComboBox QAbstractItemView { + color: #a9b7c6; + background: #1e1d23; + selection-color: #FFFFFF; + selection-background-color: #1e1d23; +} +QComboBox:!editable:on, QComboBox::drop-down:editable:on { + color: #a9b7c6; + background: #1e1d23; +} +QFontComboBox { + color: #a9b7c6; + background-color: #1e1d23; +} +QToolBox { + color: #a9b7c6; + background-color: #1e1d23; +} +QToolBox::tab { + color: #a9b7c6; + background-color: #1e1d23; +} +QToolBox::tab:selected { + color: #FFFFFF; + background-color: #1e1d23; +} +QScrollArea { + color: #FFFFFF; + background-color: #1e1d23; +} +QSlider::groove:horizontal { + height: 5px; + background: #04b97f; +} +QSlider::groove:vertical { + width: 5px; + background: #04b97f; +} +QSlider::handle:horizontal { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f); + border: 1px solid #5c5c5c; + width: 14px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: qlineargradient(x1:1, y1:1, x2:0, y2:0, stop:0 #b4b4b4, stop:1 #8f8f8f); + border: 1px solid #5c5c5c; + height: 14px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal { + background: white; +} +QSlider::add-page:vertical { + background: white; +} +QSlider::sub-page:horizontal { + background: #04b97f; +} +QSlider::sub-page:vertical { + background: #04b97f; +} diff --git a/qss样式表/QSS-master/QSS/NeonButtons.qss b/qss样式表/QSS-master/QSS/NeonButtons.qss new file mode 100644 index 0000000..8065250 --- /dev/null +++ b/qss样式表/QSS-master/QSS/NeonButtons.qss @@ -0,0 +1,47 @@ +/* +Neon Style Sheet for QT Applications (QpushButton) +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 24/10/2020, 15:42. +Available at: https://github.com/GTRONICK/QSS/blob/master/NeonButtons.qss +*/ +QPushButton{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: #100E19; +} +QPushButton::default{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #FFFFFF; + padding: 2px; + background-color: #151a1e; +} +QPushButton:hover{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:1, stop:0 #C0DB50, stop:0.4 #C0DB50, stop:0.5 #100E19, stop:1 #100E19); + border-bottom-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:1, stop:0 #100E19, stop:0.5 #100E19, stop:0.6 #C0DB50, stop:1 #C0DB50); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #C0DB50, stop:0.3 #C0DB50, stop:0.7 #100E19, stop:1 #100E19); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 #C0DB50, stop:0.3 #C0DB50, stop:0.7 #100E19, stop:1 #100E19); + border-width: 2px; + border-radius: 1px; + color: #d3dae3; + padding: 2px; +} +QPushButton:pressed{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:1, stop:0 #d33af1, stop:0.4 #d33af1, stop:0.5 #100E19, stop:1 #100E19); + border-bottom-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:1, stop:0 #100E19, stop:0.5 #100E19, stop:0.6 #d33af1, stop:1 #d33af1); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #d33af1, stop:0.3 #d33af1, stop:0.7 #100E19, stop:1 #100E19); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 #d33af1, stop:0.3 #d33af1, stop:0.7 #100E19, stop:1 #100E19); + border-width: 2px; + border-radius: 1px; + color: #d3dae3; + padding: 2px; +} \ No newline at end of file diff --git a/qss样式表/QSS-master/QSS/QSS_IMG/go-down-symbolic.symbolic.png b/qss样式表/QSS-master/QSS/QSS_IMG/go-down-symbolic.symbolic.png new file mode 100644 index 0000000..bfa7706 Binary files /dev/null and b/qss样式表/QSS-master/QSS/QSS_IMG/go-down-symbolic.symbolic.png differ diff --git a/qss样式表/QSS-master/QSS/QSS_IMG/go-next-symbolic.symbolic.png b/qss样式表/QSS-master/QSS/QSS_IMG/go-next-symbolic.symbolic.png new file mode 100644 index 0000000..f2aa968 Binary files /dev/null and b/qss样式表/QSS-master/QSS/QSS_IMG/go-next-symbolic.symbolic.png differ diff --git a/qss样式表/QSS-master/QSS/QSS_IMG/go-previous-symbolic.symbolic.png b/qss样式表/QSS-master/QSS/QSS_IMG/go-previous-symbolic.symbolic.png new file mode 100644 index 0000000..f688c3c Binary files /dev/null and b/qss样式表/QSS-master/QSS/QSS_IMG/go-previous-symbolic.symbolic.png differ diff --git a/qss样式表/QSS-master/QSS/QSS_IMG/go-up-symbolic.symbolic.png b/qss样式表/QSS-master/QSS/QSS_IMG/go-up-symbolic.symbolic.png new file mode 100644 index 0000000..ea3ce32 Binary files /dev/null and b/qss样式表/QSS-master/QSS/QSS_IMG/go-up-symbolic.symbolic.png differ diff --git a/qss样式表/QSS-master/QSS/QSS_IMG/object-select-symbolic.symbolic.png b/qss样式表/QSS-master/QSS/QSS_IMG/object-select-symbolic.symbolic.png new file mode 100644 index 0000000..ef1034a Binary files /dev/null and b/qss样式表/QSS-master/QSS/QSS_IMG/object-select-symbolic.symbolic.png differ diff --git a/qss样式表/QSS-master/QSS/README.md b/qss样式表/QSS-master/QSS/README.md new file mode 100644 index 0000000..ec16dcc --- /dev/null +++ b/qss样式表/QSS-master/QSS/README.md @@ -0,0 +1,45 @@ +### QT StyleSheet templates ### +Themes available: +1. [Ubuntu](https://github.com/GTRONICK/QSS/blob/master/Ubuntu.qss) + +![Ubuntu theme screenshot](https://i.imgur.com/i8zVYwL.png) + +2. [ElegantDark](https://github.com/GTRONICK/QSS/blob/master/ElegantDark.qss) + +![ElegantDark theme screenshot](https://i.imgur.com/AUb7R7P.png) + +3. [MaterialDark](https://github.com/GTRONICK/QSS/blob/master/MaterialDark.qss) + +![MaterialDark theme screenshot](https://i.imgur.com/ViEQxdh.png) + +4. [ConsoleStyle](https://github.com/GTRONICK/QSS/blob/master/ConsoleStyle.qss) + +![ConsoleStyle theme screenshot](https://i.imgur.com/E10ukaA.png) + +5. [AMOLED](https://github.com/GTRONICK/QSS/blob/master/AMOLED.qss) + +![AMOLED theme screenshot](https://i.imgur.com/M7RIx4c.png) + +6. [Aqua](https://github.com/GTRONICK/QSS/blob/master/Aqua.qss) + +![Aqua theme screenshot](https://i.imgur.com/i8zVYwL.png) + +## The ManjaroMix Theme!: Includes a radial gradient for Checkboxes, and minimalist arrows for scrollbars. ## +7. [ManjaroMix](https://github.com/GTRONICK/QSS/blob/master/ManjaroMix.qss) + +![ManjaroMix theme screenshot](https://i.imgur.com/7zrMDMH.png) + +8. [NeonButtons](https://github.com/GTRONICK/QSS/blob/master/NeonButtons.qss) + +![NeonButtons screenshot](https://i.imgur.com/IqTSQG2.png) +![NeonButtons screenshot](https://i.imgur.com/l4im5Ve.png) + +## MacOS Theme!: Reduced code, image integration through URL resources. ## +9. [MacOS](https://github.com/GTRONICK/QSS/blob/master/MacOS.qss) + +![MacOS](https://i.imgur.com/quEgiVe.png) +**Added images in QSS_IMG folder** + +Stay tunned!, this files are being updated frequently. +*Consider donating :)* **PayPal Account:** gtronick@gmail.com + diff --git a/qss样式表/QSS-master/QSS/Ubuntu.qss b/qss样式表/QSS-master/QSS/Ubuntu.qss new file mode 100644 index 0000000..5f713c1 --- /dev/null +++ b/qss样式表/QSS-master/QSS/Ubuntu.qss @@ -0,0 +1,496 @@ +/* +Ubuntu Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 01/10/2021 (dd/mm/yyyy), 15:18. +Available at: https://github.com/GTRONICK/QSS/blob/master/Ubuntu.qss +*/ +QMainWindow { + background-color:#f0f0f0; +} +QCheckBox { + padding:2px; +} +QCheckBox:hover { + border:1px solid rgb(255,150,60); + border-radius:4px; + padding: 1px; + background-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(190, 90, 50, 50), stop:1 rgba(250, 130, 40, 50)); +} +QCheckBox::indicator:checked { + border:1px solid rgb(246, 134, 86); + border-radius:4px; + background-color:rgb(246, 134, 86) +} +QCheckBox::indicator:unchecked { + border-width:1px solid rgb(246, 134, 86); + border-radius:4px; + background-color:rgb(255,255,255); +} +QColorDialog { + background-color:#f0f0f0; +} +QComboBox { + color:rgb(81,72,65); + background: #ffffff; +} +QComboBox:editable { + selection-color:rgb(81,72,65); + selection-background-color: #ffffff; +} +QComboBox QAbstractItemView { + selection-color: #ffffff; + selection-background-color: rgb(246, 134, 86); +} +QComboBox:!editable:on, QComboBox::drop-down:editable:on { + color: #1e1d23; +} +QDateTimeEdit, QDateEdit, QDoubleSpinBox, QFontComboBox { + color:rgb(81,72,65); + background-color: #ffffff; +} + +QDialog { + background-color:#f0f0f0; +} + +QLabel,QLineEdit { + color:rgb(17,17,17); +} +QLineEdit { + background-color:rgb(255,255,255); + selection-background-color:rgb(236,116,64); +} +QMenuBar { + color:rgb(223,219,210); + background-color:rgb(65,64,59); +} +QMenuBar::item { + padding-top:4px; + padding-left:4px; + padding-right:4px; + color:rgb(223,219,210); + background-color:rgb(65,64,59); +} +QMenuBar::item:selected { + color:rgb(255,255,255); + padding-top:2px; + padding-left:2px; + padding-right:2px; + border-top-width:2px; + border-left-width:2px; + border-right-width:2px; + border-top-right-radius:4px; + border-top-left-radius:4px; + border-style:solid; + background-color:rgb(65,64,59); + border-top-color: rgb(47,47,44); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(90, 87, 78, 255), stop:1 rgba(47,47,44, 255)); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 rgba(90, 87, 78, 255), stop:1 rgba(47,47,44, 255)); +} +QMenu { + color:rgb(223,219,210); + background-color:rgb(65,64,59); +} +QMenu::item { + color:rgb(223,219,210); + padding:4px 10px 4px 20px; +} +QMenu::item:selected { + color:rgb(255,255,255); + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(225, 108, 54, 255), stop:1 rgba(246, 134, 86, 255)); + border-style:solid; + border-width:3px; + padding:4px 7px 4px 17px; + border-bottom-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(175,85,48,255), stop:1 rgba(236,114,67, 255)); + border-top-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); + border-right-color:qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); + border-left-color:qlineargradient(spread:pad, x1:1, y1:0.5, x2:0, y2:0.5, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); +} +QPlainTextEdit { + border: 1px solid transparent; + color:rgb(17,17,17); + selection-background-color:rgb(236,116,64); + background-color: #FFFFFF; +} +QProgressBar { + text-align: center; + color: rgb(0, 0, 0); + border: 1px inset rgb(150,150,150); + border-radius: 10px; + background-color:rgb(221,221,219); +} +QProgressBar::chunk:horizontal { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(225, 108, 54, 255), stop:1 rgba(246, 134, 86, 255)); + border:1px solid; + border-radius:8px; + border-bottom-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(175,85,48,255), stop:1 rgba(236,114,67, 255)); + border-top-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); + border-right-color:qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); + border-left-color:qlineargradient(spread:pad, x1:1, y1:0.5, x2:0, y2:0.5, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); +} +QPushButton{ + color:rgb(17,17,17); + border-width: 1px; + border-radius: 6px; + border-bottom-color: rgb(150,150,150); + border-right-color: rgb(165,165,165); + border-left-color: rgb(165,165,165); + border-top-color: rgb(180,180,180); + border-style: solid; + padding: 4px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(220, 220, 220, 255), stop:1 rgba(255, 255, 255, 255)); +} +QPushButton:hover{ + color:rgb(17,17,17); + border-width: 1px; + border-radius:6px; + border-top-color: rgb(255,150,60); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 255)); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 255)); + border-bottom-color: rgb(200,70,20); + border-style: solid; + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(220, 220, 220, 255), stop:1 rgba(255, 255, 255, 255)); +} +QPushButton:default{ + color:rgb(17,17,17); + border-width: 1px; + border-radius:6px; + border-top-color: rgb(255,150,60); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 255)); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 255)); + border-bottom-color: rgb(200,70,20); + border-style: solid; + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(220, 220, 220, 255), stop:1 rgba(255, 255, 255, 255)); +} +QPushButton:pressed{ + color:rgb(17,17,17); + border-width: 1px; + border-radius: 6px; + border-width: 1px; + border-top-color: rgba(255,150,60,200); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 200)); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 200)); + border-bottom-color: rgba(200,70,20,200); + border-style: solid; + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(220, 220, 220, 255), stop:1 rgba(255, 255, 255, 255)); +} +QPushButton:disabled{ + color:rgb(174,167,159); + border-width: 1px; + border-radius: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(200, 200, 200, 255), stop:1 rgba(230, 230, 230, 255)); +} +QRadioButton { + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: rgba(246, 134, 86, 255); + color: #a9b7c6; + background-color:rgba(246, 134, 86, 255); +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: rgb(246, 134, 86); + color: #a9b7c6; + background-color: transparent; +} +QScrollArea { + color: white; + background-color:#f0f0f0; +} +QSlider::groove { + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); +} +QSlider::groove:horizontal { + height: 5px; + background: rgb(246, 134, 86); +} +QSlider::groove:vertical { + width: 5px; + background: rgb(246, 134, 86); +} +QSlider::handle:horizontal { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + width: 12px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + height: 12px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal, QSlider::add-page:vertical { + background: white; +} +QSlider::sub-page:horizontal, QSlider::sub-page:vertical { + background: rgb(246, 134, 86); +} +QStatusBar, QSpinBox { + color:rgb(81,72,65); +} +QSpinBox { + background-color: #ffffff; +} +QScrollBar:horizontal { + max-height: 20px; + border: 1px transparent; + margin: 0px 20px 0px 20px; +} +QScrollBar::handle:horizontal { + background: rgb(253,253,253); + border: 1px solid rgb(207,207,207); + border-radius: 7px; + min-width: 25px; +} +QScrollBar::handle:horizontal:hover { + background: rgb(253,253,253); + border: 1px solid rgb(255,150,60); + border-radius: 7px; + min-width: 25px; +} +QScrollBar::add-line:horizontal { + border: 1px solid rgb(207,207,207); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-right-radius: 7px; + background: rgb(255, 255, 255); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:hover { + border: 1px solid rgb(255,150,60); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-right-radius: 7px; + background: rgb(255, 255, 255); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:pressed { + border: 1px solid grey; + border-top-left-radius: 7px; + border-top-right-radius: 7px; + border-bottom-right-radius: 7px; + background: rgb(231,231,231); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal { + border: 1px solid rgb(207,207,207); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(255, 255, 255); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:hover { + border: 1px solid rgb(255,150,60); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(255, 255, 255); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:pressed { + border: 1px solid grey; + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(231,231,231); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::left-arrow:horizontal { + border: 1px transparent grey; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; + width: 6px; + height: 6px; + background: rgb(230,230,230); +} +QScrollBar::right-arrow:horizontal { + border: 1px transparent grey; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; + width: 6px; + height: 6px; + background: rgb(230,230,230); +} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} +QScrollBar:vertical { + max-width: 20px; + border: 1px transparent grey; + margin: 20px 0px 20px 0px; +} +QScrollBar::add-line:vertical { + border: 1px solid; + border-color: rgb(207,207,207); + border-bottom-right-radius: 7px; + border-bottom-left-radius: 7px; + border-top-left-radius: 7px; + background: rgb(255, 255, 255); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:hover { + border: 1px solid; + border-color: rgb(255,150,60); + border-bottom-right-radius: 7px; + border-bottom-left-radius: 7px; + border-top-left-radius: 7px; + background: rgb(255, 255, 255); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:pressed { + border: 1px solid grey; + border-bottom-left-radius: 7px; + border-bottom-right-radius: 7px; + border-top-left-radius: 7px; + background: rgb(231,231,231); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical { + border: 1px solid rgb(207,207,207); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(255, 255, 255); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:hover { + border: 1px solid rgb(255,150,60); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(255, 255, 255); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:pressed { + border: 1px solid grey; + border-top-left-radius: 7px; + border-top-right-radius: 7px; + background: rgb(231,231,231); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::handle:vertical { + background: rgb(253,253,253); + border: 1px solid rgb(207,207,207); + border-radius: 7px; + min-height: 25px; +} +QScrollBar::handle:vertical:hover { + background: rgb(253,253,253); + border: 1px solid rgb(255,150,60); + border-radius: 7px; + min-height: 25px; +} +QScrollBar::up-arrow:vertical { + border: 1px transparent grey; + border-top-left-radius: 3px; + border-top-right-radius: 3px; + width: 6px; + height: 6px; + background: rgb(230,230,230); +} +QScrollBar::down-arrow:vertical { + border: 1px transparent grey; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + width: 6px; + height: 6px; + background: rgb(230,230,230); +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} +QTabWidget { + color:rgb(0,0,0); + background-color:rgb(247,246,246); +} +QTabWidget::pane { + border-color: rgb(180,180,180); + background-color:rgb(247,246,246); + border-style: solid; + border-width: 1px; + border-radius: 6px; +} +QTabBar::tab { + padding-left:4px; + padding-right:4px; + padding-bottom:2px; + padding-top:2px; + color:rgb(81,72,65); + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(221,218,217,255), stop:1 rgba(240,239,238,255)); + border-style: solid; + border-width: 1px; + border-top-right-radius:4px; + border-top-left-radius:4px; + border-top-color: rgb(180,180,180); + border-left-color: rgb(180,180,180); + border-right-color: rgb(180,180,180); + border-bottom-color: transparent; +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + background-color:rgb(247,246,246); + margin-left: 0px; + margin-right: 1px; +} +QTabBar::tab:!selected { + margin-top: 1px; + margin-right: 1px; +} +QTextEdit { + border-width: 1px; + border-style: solid; + border-color:transparent; + color:rgb(17,17,17); + selection-background-color:rgb(236,116,64); +} +QTimeEdit, QToolBox, QToolBox::tab, QToolBox::tab:selected { + color:rgb(81,72,65); + background-color: #ffffff; +} diff --git a/qss样式表/a6223-main.zip b/qss样式表/a6223-main.zip new file mode 100644 index 0000000..0d454ec Binary files /dev/null and b/qss样式表/a6223-main.zip differ diff --git a/qss样式表/a6223-main/a6223-main/LICENSE b/qss样式表/a6223-main/a6223-main/LICENSE new file mode 100644 index 0000000..63b4b68 --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [year] [fullname] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集.rar b/qss样式表/a6223-main/a6223-main/QSS模板合集.rar new file mode 100644 index 0000000..db6c839 Binary files /dev/null and b/qss样式表/a6223-main/a6223-main/QSS模板合集.rar differ diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/1.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/1.qss new file mode 100644 index 0000000..6c7b53e --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/1.qss @@ -0,0 +1,927 @@ + + +*{ + font-size:13px; + color:white; + font-family:"宋体"; +} + +CallWidget QLineEdit#telEdt +{ + font-size:24px; + +} + +QMainWindow,QDialog{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #1B2534, stop: 0.4 #010101, + stop: 0.5 #000101, stop: 1.0 #1F2B3C); +} +QWidget{ + background:#121922; +} + +QLabel{ + background:transparent; +} + + + + +DailForm QLineEdit#phoneLineEdt{ + font-size:36px; + font-weight: bold; +} + +QPushButton,QToolButton{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #5B5F5F, stop: 0.5 #0C2436, + stop: 1.0 #27405A); + border-style: outset; + border-width: 1px; + border-radius: 5px; + border-color: #11223F; + padding: 1px; +} + +QPushButton::hover,QToolButton::hover{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #758385, stop: 0.5 #122C39, + stop: 1.0 #0E7788); + border-color: #11505C; +} + +QPushButton::pressed,QToolButton::pressed{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #969B9C, stop: 0.5 #16354B, + stop: 1.0 #244F76); + border-color: #11505C; +} +QPushButton::disabled,QToolButton::disabled{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #282B2C, stop: 0.5 #09121A, + stop: 1.0 #111D29); + border-color: #0A1320; + color:#6A6864; + +} + + + +QDialog QPushButton,QDialog QToolButton{ + min-width:30px; + min-height:23px; +} + +QToolButton[objectName="minimizeToolBtn"] { + background: transparent; + border:none; + image:url(qss/minimize.png) +} +QToolButton[objectName="minimizeToolBtn"]:hover,QToolButton[objectName="minimizeToolBtn"]:pressed { + image:url(qss/minimize_hover.png) +} +QToolButton[objectName="maximizeToolBtn"] { + background: transparent; + border:none; + image:url(qss/maximize.png) +} +QToolButton[objectName="maximizeToolBtn"]:hover,QToolButton[objectName="maximizeToolBtn"]:pressed { + image:url(qss/maximize_hover.png) +} + +QToolButton[objectName="closeToolBtn"],QToolButton[objectName="customCloseWindow"] { + background: transparent; + border:none; + image:url(qss/close.png) +} +QToolButton[objectName="closeToolBtn"]:hover,QToolButton[objectName="closeToolBtn"]:pressed{ + image:url(qss/close_hover.png) +} +QToolButton[objectName="customCloseWindow"]:hover,QToolButton[objectName="customCloseWindow"]:pressed{ + image:url(qss/close_hover.png) +} +QToolButton[objectName="titleSetUpToolBtn"]{ + background: transparent; + border:none; + image:url(qss/setup.png) +} + + +DailForm QToolButton#oneToolBtn,QToolButton#OneToolBtn,QToolButton#twoToolBtn,QToolButton#threeToolBtn, + QToolButton#fourToolBtn,QToolButton#fiveToolBtn,QToolButton#sixToolBtn, + QToolButton#sevenToolBtn,QToolButton#eightToolBtn,QToolButton#nineToolBtn, + QToolButton#starToolBtn,QToolButton#zeroToolBtn,QToolButton#sharpToolBtn { + font-size:36px; + border-radius: 10px; + +} +DailForm QToolButton#delToolBtn{ + border-radius: 10px; + +} + + + + + + +QLineEdit,QTextEdit { + border: 1px solid #32435E; + border-radius: 3px; + /* padding: 0 8px; */ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #080B10, + stop: 1.0 #212C3F); + selection-background-color: #0A246A; + +} +QLineEdit::hover{ + border-color:#5D8B9E; +} + +QLineEdit[echoMode="3"] { + lineedit-password-character: 9679; +} + +#QLineEdit:read-only { + background: #543F7C; +} + + + + + + + QTabBar::tab { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #292F31, stop: 1 #0C131E); + } +QTabBar::tab:selected{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #113845, stop: 1.0 #15A8FF); + } +QTabBar::tab:hover { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #113845, stop: 1.0 #0E6F80); + } + + #QTabBar::tab:selected { + border-color: #32435E; + border-right-color: #32435E; /* same as pane color */ + } + + #QTabBar::tab:!selected { + margin-left: 2px; /* make non-selected tabs look smaller */ + } +#QTabBar:tab:first:selected { + margin-top: 0; +} +QTabBar:tab:last:selected { + margin-right: 0; +} +QTabBar:tab:only-one { + margin: 0; +} + +QListWidget{ + border: 1px solid #32435E; + background:#050609; +} + + +QListWidget::item:selected { + /*border: 0px solid #33CCFF;*/ + border:none; + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #6A848C, stop: 1.0 #0F9EAF); + padding:0px; + margin:0px; +} + +#QListWidget::item:selected:!active { + border-width: 0px ; + } +#QListWidget::item:selected:active { + border-width: 1px; + } + + + + +QComboBox { + border: 1px solid #32435E; + border-radius: 3px; + padding: 1px 18px 1px 3px; + min-width: 6em; + } +QComboBox::hover{ + border-color:#5D8B9E; +} + + + QComboBox:editable { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #080B10, + stop: 1.0 #212C3F); + } + + QComboBox:!editable, QComboBox::drop-down:editable { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #080B10, + stop: 1.0 #212C3F); + } + + /* QComboBox gets the "on" state when the popup is open */ + QComboBox:!editable:on, QComboBox::drop-down:editable:on { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #080B10, + stop: 1.0 #212C3F);; + } + + QComboBox:on { /* shift the text when the popup opens */ + padding-top: 3px; + padding-left: 4px; + } + QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 15px; + + border-left-width: 1px; + border-left-color: 32435E; + border-left-style: solid; /* just a single line */ + border-top-right-radius: 3px; /* same radius as the QComboBox */ + border-bottom-right-radius: 3px; + } + + QComboBox::down-arrow { + image: url(qss/downarrow.png); + } + + QComboBox::down-arrow:on { /* shift the arrow when popup is open */ + top: 1px; + left: 1px; + } + + QComboBox QAbstractItemView { + border: 2px solid #32435E; + selection-background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #506B79, + stop: 1.0 #0D95A6); + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #1B2534, stop: 0.4 #010101, + stop: 0.5 #000101, stop: 1.0 #1F2B3C); + } + + + + + +QCheckBox { + spacing: 5px; + } + + QCheckBox::indicator { + width: 13px; + height: 13px; + } + + QCheckBox::indicator:unchecked { + image: url(:/qss/checkbox_unchecked.png); + } + + QCheckBox::indicator:unchecked:hover { + image: url(:/qss/checkbox_unchecked_hover.png); + } + + QCheckBox::indicator:unchecked:pressed { + image: url(:/qss/checkbox_unchecked_pressed.png); + } + + QCheckBox::indicator:checked { + image: url(:/qss/checkbox_checked.png); + } + + QCheckBox::indicator:checked:hover { + image: url(:/qss/checkbox_checked_hover.png); + } + + QCheckBox::indicator:checked:pressed { + image: url(:/qss/checkbox_checked_pressed.png); + } + + QCheckBox::indicator:indeterminate:hover { + image: url(:/qss/checkbox_indeterminate_hover.png); + } + + QCheckBox::indicator:indeterminate:pressed { + image: url(:/qss/checkbox_indeterminate_pressed.png); + } + + + + + + QMenu { + background-color: #030406; + border-width:0px; + margin: 2px; + } + + QMenu::item { + background-color: #1D2838; + padding: 2px 25px 2px 20px; + border-color:transparent; + color:#858E94; + } + QMenu::item:!enabled { + background-color: #1D2838; + padding: 2px 25px 2px 20px; + border-color:transparent; + color:#76746C; + } + + QMenu::item:selected { + border-width:1px; + border-color: #516589; + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #1E293A, + stop: 1.0 #2C547E); + color:#E6FFFF; + } + + QMenu::icon:checked { /* appearance of a 'checked' icon */ + background: gray; + border: 1px inset gray; + position: absolute; + top: 1px; + right: 1px; + bottom: 1px; + left: 1px; + } + + QMenu::separator { + height: 1px; + background: #1D99A9; + /*margin-left: 10px;*/ + /*margin-right: 5px;*/ + } + + QMenu::indicator { + width: 13px; + height: 13px; + } + + /* non-exclusive indicator = check box style indicator (see QActionGroup::setExclusive) */ + QMenu::indicator:non-exclusive:unchecked { + image: url(qss/checkbox_unchecked.png); + } + + QMenu::indicator:non-exclusive:unchecked:selected { + image: url(qss/checkbox_unchecked_hover.png); + } + + QMenu::indicator:non-exclusive:checked { + image: url(qss/checkbox_checked.png); + } + + QMenu::indicator:non-exclusive:checked:selected { + image: url(qss/checkbox_checked_hover.png); + } + + /* exclusive indicator = radio button style indicator (see QActionGroup::setExclusive) */ + QMenu::indicator:exclusive:unchecked { + image: url(qss/radiobutton_unchecked.png); + } + + QMenu::indicator:exclusive:unchecked:selected { + image: url(qss/radiobutton_unchecked_hover.png); + } + + QMenu::indicator:exclusive:checked { + image: url(qss/radiobutton_checked.png); + } + + QMenu::indicator:exclusive:checked:selected { + image: url(qss/radiobutton_checked_hover.png); + } + + QMenuBar { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #121722, stop:1 #121722); + } + + QMenuBar::item { + spacing: 3px; /* spacing between menu bar items */ + padding: 1px 4px; + background: #10151E; + border-radius: 4px; + font:#BBDDFF; + } + + QMenuBar::item:selected { /* when selected using mouse or keyboard */ + background: #1A2432; + font:#FFFFFF; + } + + QMenuBar::item:pressed { + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #10151E, stop:1 #2C547E); + font:#FFFFFF; + + } + QMenuBar::item:hover{ + border-width:1px; + border-color:#516589; + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #9979A, stop:1 #2D567F); + font:#FFFFFF; + + } + +QListView{ + border: 1px solid #32435E; + background:#050609; +} + + + + QRadioButton::indicator { + width: 13px; + height: 13px; + } + + QRadioButton::indicator::unchecked { + image: url(qss/radiobutton_unchecked.png); + } + + QRadioButton::indicator:unchecked:hover { + image: url(qss/radiobutton_unchecked_hover.png); + } + + QRadioButton::indicator:unchecked:pressed { + image: url(qss/radiobutton_unchecked_pressed.png); + } + + QRadioButton::indicator::checked { + image: url(qss/radiobutton_checked.png); + } + + QRadioButton::indicator:checked:hover { + image: url(qss/radiobutton_checked_hover.png); + } + + QRadioButton::indicator:checked:pressed { + image: url(qss/radiobutton_checked_pressed.png); + } + + + QGroupBox { + border: 1px solid #2E3D57; + border-radius: 5px; + margin-top: 1ex; /* leave space at the top for the title */ + } + + QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top left; + padding: 0 3px; + background-color: transparent; + } + + QGroupBox::indicator { + width: 13px; + height: 13px; + } + + QGroupBox::indicator:unchecked { + image: url(qss/checkbox_unchecked.png); + } +QGroupBox::indicator:checked { + image: url(qss/checkbox_checked.png); +} + +QScrollBar:vertical { + border: 1px solid #32435E; + border-width: 0px 0px 0px 1px; + background: #21252F; + width: 12px; + margin: 12px 0 12px 0; + } + QScrollBar::handle:vertical { + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #60788C, stop:1 #1084BD); + min-height: 20px; + } + QScrollBar::add-line:vertical { + border: 1px solid #32435E; + border-width:0px 0px 0px 1px; + background:#21252F; + height: 12px; + subcontrol-position: bottom; + subcontrol-origin: margin; + } + + QScrollBar::sub-line:vertical { + border: 1px solid #32435E; + border-width:0px 0px 0px 1px; + background: #21252F; + height: 12px; + subcontrol-position: top; + subcontrol-origin: margin; + } + QScrollBar::up-arrow:vertical { + border: 1px solid transparent; + background: #21252F; + image: url(qss/up_arrow.png); + width: 7px; + height: 7px; + } + QScrollBar::up-arrow:vertical:hover,QScrollBar::up-arrow:vertical:pressed { + image: url(qss/up_arrow_hover.png); + } + + QScrollBar::down-arrow:vertical{ + border: 1px solid transparent; + background: #21252F; + image:url(qss/down_arrow.png); + width: 7px; + height: 7px; + } +QScrollBar::down-arrow:vertical:hover,QScrollBar::down-arrow:vertical:pressed{ + image: url(qss/down_arrow_hover.png); +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} + + + QScrollBar:horizontal { + border: 1px solid #32435E; + border-width: 1px 0px 0px 0px; + background: #21252F; + height: 12px; + margin: 0 12px 0 12px; + } + QScrollBar::handle:horizontal { + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #60788C, stop:1 #1084BD); + min-width: 20px; + } + QScrollBar::add-line:horizontal { + border: 1px solid #32435E; + border-width:1px 0px 0px 0px; + background:#21252F; + width: 12px; + subcontrol-position: right; + subcontrol-origin: margin; + } + + QScrollBar::sub-line:horizontal { + border: 1px solid #32435E; + border-width:1px 0px 0px 0px; + background: #21252F; + width: 12px; + subcontrol-position: left; + subcontrol-origin: margin; + } + QScrollBar::left-arrow:horizontal { + border: 1px solid transparent; + background: #21252F; + image: url(qss/left_arrow.png); + width: 7px; + height: 7px; + } + QScrollBar::left-arrow:horizontal:hover,QScrollBar::left-arrow:horizontal:pressed { + image: url(qss/left_arrow_hover.png); + } + + QScrollBar::right-arrow:horizontal{ + border: 1px solid transparent; + background: #21252F; + image:url(qss/right_arrow.png); + width: 7px; + height: 7px; + } +QScrollBar::right-arrow:horizontal:hover,QScrollBar::right-arrow:horizontal:pressed{ + image: url(qss/right_arrow_hover.png); +} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} + + + + + + + + +QSpinBox,QDateTimeEdit { + border: 1px solid #32435E; + border-radius: 3px; + padding-right: 5px; /* make room for the arrows */ + /* border-image: url(qss/frame.png) 4; */ + background:qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #080B10, stop:1 #212C3F); + } + QSpinBox::hover,QDateTimeEdit::hover{ + border-color:#5D8B9E; + } + + QSpinBox::up-button, QDateTimeEdit::up-button { + subcontrol-origin: border; + subcontrol-position: top right; /* position at the top right corner */ + + width: 16px; /* 16 + 2*1px border-width = 15px padding + 3px parent border */ + border-image: url(qss/spinup.png) 1; + border-width: 1px; + + + } + + QSpinBox::up-button:hover,QDateTimeEdit::up-button:hover { + border-image: url(qss/spinup_hover.png) 1; + } + + QSpinBox::up-button:pressed,QDateTimeEdit::up-button:pressed { + border-image: url(qss/spinup_pressed.png) 1; + } + + QSpinBox::up-arrow,QDateTimeEdit::up-arrow { + image: url(qss/up_arrow.png); + width: 7px; + height: 7px; + } + + QSpinBox::up-arrow:disabled, QSpinBox::up-arrow:off,QDateTimeEdit::up-arrow:disabled,QDateTimeEdit::up-arrow:off { /* off state when value is max */ + image: url(qss/up_arrow_disabled.png); + } + + QSpinBox::down-button,QDateTimeEdit::down-button { + subcontrol-origin: border; + subcontrol-position: bottom right; /* position at bottom right corner */ + + width: 16px; + border-image: url(qss/spindown.png) 1; + border-width: 1px; + border-top-width: 0; + } + + QSpinBox::down-button:hover,QDateTimeEdit::down-button:hover { + border-image: url(qss/spindown_hover.png) 1; + } + + QSpinBox::down-button:pressed,QDateTimeEdit::down-button:pressed { + border-image: url(qss/spindown_pressed.png) 1; + } + + QSpinBox::down-arrow,QDateTimeEdit::down-arrow { + image: url(qss/down_arrow.png); + width: 7px; + height: 7px; + } + + QSpinBox::down-arrow:disabled,QDateTimeEdit::down-arrow:disabled, + QSpinBox::down-arrow:off,QDateTimeEdit::down-arrow:off { /* off state when value in min */ + image: url(qss/down_arrow_disabled.png); + } + + + + + QToolTip { + border: 1.5px solid #179BAB; + padding: 3px; + border-radius: 8px; + opacity: 200; /*透明度*/ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #0C1016, + stop: 1.0 #233043); + } + + QStatusBar { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #07090E, + stop: 1.0 #202C3D); + } + + QStatusBar::item { + border: 1px solid #3E58A5; + border-radius: 3px; + } + +#QStatusBar QLabel { + border: 1px solid #6AF0FF; + /*background: white; */ +} + + +QSizeGrip { /*在MainWindow右下角*/ + image: url(qss/sizegrip.png); + width: 16px; + height: 16px; + } + + + + QHeaderView::section { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #353B43, stop:1 #151A20); + color: white; + padding-left: 4px; + border: 1px solid #447684; + } + + /* style the sort indicator */ + QHeaderView::down-arrow { + image: url(qss/down_arrow.png); + } + + QHeaderView::up-arrow { + image: url(qss/up_arrow.png); + } + QTableView { + selection-background-color: qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5, + stop: 0 #516A78, stop: 1 #10A9BA); + + gridline-color:#447684; + } + + + + +QFrame#customTitleBar{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #454F53, stop: 1.0 #135263); +} + + +QWidget#TranslucentWidget * +{ + background-color: rgba( 255, 255, 255, 100 ); +} + +QWidget#TranslucentWidget QFrame#frame +{ + border-radius: 5px; +} + +QWidget#TranslucentWidget QPushButton { + + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #5B5F5F, stop: 0.5 #0C2436, + stop: 1.0 #27405A); + background-color: rgba( 255, 255, 255, 100 ); +} + +QWidget#TranslucentWidget QPushButton::hover{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #758385, stop: 0.5 #122C39, + stop: 1.0 #0E7788); + border-color: #11505C; +} + +QWidget#TranslucentWidget QPushButton::pressed{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #969B9C, stop: 0.5 #16354B, + stop: 1.0 #244F76); + border-color: #11505C; +} + + + +QWidget#GroupChatingWidget * +{ + background-color: rgba( 93, 93, 93, 30 ); + color:#000080; +} + +QWidget#GroupChatingWidget QLabel +{ + background: transparent; +} + +QWidget#GroupChatingWidget QFrame#mainFrame +{ + border-radius: 5px; +} + + + +QWidget#GroupChatingWidget QPushButton::hover,QWidget#GroupChatingWidget QToolButton::hover{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #758385, stop: 0.5 #122C39, + stop: 1.0 #0E7788); + border-color: #11505C; +} + +QWidget#GroupChatingWidget QPushButton::pressed,QWidget#GroupChatingWidget QToolButton::pressed{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #969B9C, stop: 0.5 #16354B, + stop: 1.0 #244F76); + border-color: #11505C; +} +QWidget#GroupChatingWidget QPushButton::disabled,QWidget#GroupChatingWidget QToolButton::disabled{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #282B2C, stop: 0.5 #09121A, + stop: 1.0 #111D29); + border-color: #0A1320; + color:#6A6864; + +} + + +QWidget#UserListWidget * +{ + background-color: rgba( 93, 93, 93, 30 ); + color:#000080; +} + +QWidget#GroupChatinSingleWidget * +{ + background-color: rgba( 93, 93, 93, 60 ); + color:#000080; +} +QWidget#GroupChatinSingleWidget QLabel +{ + background: transparent; +} +QWidget#GroupChatingWidget QPushButton::hover,QWidget#GroupChatingWidget QToolButton::hover{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #758385, stop: 0.5 #122C39, + stop: 1.0 #0E7788); + border-color: #11505C; +} + +QWidget#GroupChatingWidget QPushButton::pressed,QWidget#GroupChatingWidget QToolButton::pressed{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #969B9C, stop: 0.5 #16354B, + stop: 1.0 #244F76); + border-color: #11505C; +} +QWidget#GroupChatingWidget QPushButton::disabled,QWidget#GroupChatingWidget QToolButton::disabled{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #282B2C, stop: 0.5 #09121A, + stop: 1.0 #111D29); + border-color: #0A1320; + color:#6A6864; + +} + +QWidget#InfoAreaWidget * +{ + background-color: rgba( 93, 93, 93, 100 ); + color:#000080; + font: 75 12pt "宋体"; +} + +QWidget#InfoAreaWidget QLabel +{ + background: transparent; +} + +QWidget#GpsLeftBottomWidget * +{ + background-color: rgba( 93, 93, 93, 30 ); + color:#000080; +} + + +QWidget#GpsSysMenuWidget * +{ + background-color: rgba( 93, 93, 93, 30 ); + color:#000080; +} + +QWidget#GpsRigthBottomWidget * +{ + background-color: rgba( 93, 93, 93, 30 ); + color:#000080; +} + + + +QWidget#GpsRightTopWidget * +{ + background-color: rgba( 93, 93, 93, 30 ); + color:#000080; +} + +QWidget#VideoImageWidget QFrame#topFrame,QWidget#VideoImageWidget QFrame#bottomFrame{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #454F53, stop: 1.0 #135263); +} + + +QWidget#NavItemMenuWidget * +{ + background-color: rgba( 93, 93, 93, 30 ); + color:#000080; +} +QWidget#NavItemMenuWidget QLabel +{ + background: transparent; +} + diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/10.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/10.qss new file mode 100644 index 0000000..c5a94aa --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/10.qss @@ -0,0 +1,390 @@ +/* +Material Dark Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Inspired on https://github.com/jxfwinter/qt-material-stylesheet +Company: GTRONICK +Last updated: 04/12/2018, 15:00. +Available at: https://github.com/GTRONICK/QSS/blob/master/MaterialDark.qss +*/ +QMainWindow { + background-color:#1e1d23; +} +QDialog { + background-color:#1e1d23; +} +QColorDialog { + background-color:#1e1d23; +} +QTextEdit { + background-color:#1e1d23; + color: #a9b7c6; +} +QPlainTextEdit { + selection-background-color:#007b50; + background-color:#1e1d23; + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-width: 1px; + color: #a9b7c6; +} +QPushButton{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-width: 1px; + border-style: solid; + color: #a9b7c6; + padding: 2px; + background-color: #1e1d23; +} +QPushButton::default{ + border-style: inset; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #04b97f; + border-width: 1px; + color: #a9b7c6; + padding: 2px; + background-color: #1e1d23; +} +QToolButton { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #04b97f; + border-bottom-width: 1px; + border-style: solid; + color: #a9b7c6; + padding: 2px; + background-color: #1e1d23; +} +QToolButton:hover{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #37efba; + border-bottom-width: 2px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 1px; + background-color: #1e1d23; +} +QPushButton:hover{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #37efba; + border-bottom-width: 1px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 2px; + background-color: #1e1d23; +} +QPushButton:pressed{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #37efba; + border-bottom-width: 2px; + border-style: solid; + color: #37efba; + padding-bottom: 1px; + background-color: #1e1d23; +} +QPushButton:disabled{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #808086; + border-bottom-width: 2px; + border-style: solid; + color: #808086; + padding-bottom: 1px; + background-color: #1e1d23; +} +QLineEdit { + border-width: 1px; border-radius: 4px; + border-color: rgb(58, 58, 58); + border-style: inset; + padding: 0 8px; + color: #a9b7c6; + background:#1e1d23; + selection-background-color:#007b50; + selection-color: #FFFFFF; +} +QLabel { + color: #a9b7c6; +} +QLCDNumber { + color: #37e6b4; +} +QProgressBar { + text-align: center; + color: rgb(240, 240, 240); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; + background-color:#1e1d23; +} +QProgressBar::chunk { + background-color: #04b97f; + border-radius: 5px; +} +QMenuBar { + background-color: #1e1d23; +} +QMenuBar::item { + color: #a9b7c6; + spacing: 3px; + padding: 1px 4px; + background: #1e1d23; +} + +QMenuBar::item:selected { + background:#1e1d23; + color: #FFFFFF; +} +QMenu::item:selected { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: #04b97f; + border-bottom-color: transparent; + border-left-width: 2px; + color: #FFFFFF; + padding-left:15px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; + background-color: #1e1d23; +} +QMenu::item { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + border-style: solid; + color: #a9b7c6; + padding-left:17px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; + background-color: #1e1d23; +} +QMenu{ + background-color:#1e1d23; +} +QTabWidget { + color:rgb(0,0,0); + background-color:#1e1d23; +} +QTabWidget::pane { + border-color: rgb(77,77,77); + background-color:#1e1d23; + border-style: solid; + border-width: 1px; + border-radius: 6px; +} +QTabBar::tab { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + border-style: solid; + color: #808086; + padding: 3px; + margin-left:3px; + background-color: #1e1d23; +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #04b97f; + border-bottom-width: 2px; + border-style: solid; + color: #FFFFFF; + padding-left: 3px; + padding-bottom: 2px; + margin-left:3px; + background-color: #1e1d23; +} + +QCheckBox { + color: #a9b7c6; + padding: 2px; +} +QCheckBox:disabled { + color: #808086; + padding: 2px; +} + +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: rgb(87, 97, 106); + background-color:#1e1d23; +} +QCheckBox::indicator:checked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #04b97f; + color: #a9b7c6; + background-color: #04b97f; +} +QCheckBox::indicator:unchecked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #04b97f; + color: #a9b7c6; + background-color: transparent; +} +QRadioButton { + color: #a9b7c6; + background-color: #1e1d23; + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #04b97f; + color: #a9b7c6; + background-color: #04b97f; +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #04b97f; + color: #a9b7c6; + background-color: transparent; +} +QStatusBar { + color:#027f7f; +} +QSpinBox { + color: #a9b7c6; + background-color: #1e1d23; +} +QDoubleSpinBox { + color: #a9b7c6; + background-color: #1e1d23; +} +QTimeEdit { + color: #a9b7c6; + background-color: #1e1d23; +} +QDateTimeEdit { + color: #a9b7c6; + background-color: #1e1d23; +} +QDateEdit { + color: #a9b7c6; + background-color: #1e1d23; +} +QComboBox { + color: #a9b7c6; + background: #1e1d23; +} +QComboBox:editable { + background: #1e1d23; + color: #a9b7c6; + selection-background-color: #1e1d23; +} +QComboBox QAbstractItemView { + color: #a9b7c6; + background: #1e1d23; + selection-color: #FFFFFF; + selection-background-color: #1e1d23; +} +QComboBox:!editable:on, QComboBox::drop-down:editable:on { + color: #a9b7c6; + background: #1e1d23; +} +QFontComboBox { + color: #a9b7c6; + background-color: #1e1d23; +} +QToolBox { + color: #a9b7c6; + background-color: #1e1d23; +} +QToolBox::tab { + color: #a9b7c6; + background-color: #1e1d23; +} +QToolBox::tab:selected { + color: #FFFFFF; + background-color: #1e1d23; +} +QScrollArea { + color: #FFFFFF; + background-color: #1e1d23; +} +QSlider::groove:horizontal { + height: 5px; + background: #04b97f; +} +QSlider::groove:vertical { + width: 5px; + background: #04b97f; +} +QSlider::handle:horizontal { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f); + border: 1px solid #5c5c5c; + width: 14px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: qlineargradient(x1:1, y1:1, x2:0, y2:0, stop:0 #b4b4b4, stop:1 #8f8f8f); + border: 1px solid #5c5c5c; + height: 14px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal { + background: white; +} +QSlider::add-page:vertical { + background: white; +} +QSlider::sub-page:horizontal { + background: #04b97f; +} +QSlider::sub-page:vertical { + background: #04b97f; +} diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/11.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/11.qss new file mode 100644 index 0000000..8065250 --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/11.qss @@ -0,0 +1,47 @@ +/* +Neon Style Sheet for QT Applications (QpushButton) +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 24/10/2020, 15:42. +Available at: https://github.com/GTRONICK/QSS/blob/master/NeonButtons.qss +*/ +QPushButton{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: #100E19; +} +QPushButton::default{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #FFFFFF; + padding: 2px; + background-color: #151a1e; +} +QPushButton:hover{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:1, stop:0 #C0DB50, stop:0.4 #C0DB50, stop:0.5 #100E19, stop:1 #100E19); + border-bottom-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:1, stop:0 #100E19, stop:0.5 #100E19, stop:0.6 #C0DB50, stop:1 #C0DB50); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #C0DB50, stop:0.3 #C0DB50, stop:0.7 #100E19, stop:1 #100E19); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 #C0DB50, stop:0.3 #C0DB50, stop:0.7 #100E19, stop:1 #100E19); + border-width: 2px; + border-radius: 1px; + color: #d3dae3; + padding: 2px; +} +QPushButton:pressed{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:1, stop:0 #d33af1, stop:0.4 #d33af1, stop:0.5 #100E19, stop:1 #100E19); + border-bottom-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:1, stop:0 #100E19, stop:0.5 #100E19, stop:0.6 #d33af1, stop:1 #d33af1); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #d33af1, stop:0.3 #d33af1, stop:0.7 #100E19, stop:1 #100E19); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 #d33af1, stop:0.3 #d33af1, stop:0.7 #100E19, stop:1 #100E19); + border-width: 2px; + border-radius: 1px; + color: #d3dae3; + padding: 2px; +} \ No newline at end of file diff --git a/BaseCommonLibrary/BaseTool/stdafx.h b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/12.qss similarity index 100% rename from BaseCommonLibrary/BaseTool/stdafx.h rename to qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/12.qss diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/13.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/13.qss new file mode 100644 index 0000000..b16f734 --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/13.qss @@ -0,0 +1,543 @@ +/*---------------------------------------------------------------主要设置----------------------------------------------------------------*/ + +*{ + font-size:13px; + color:white; + font-family:"宋体"; +} + +CallWidget QLineEdit#telEdt +{ + font-size:24px; + +} + +QMainWindow,QDialog{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, /*背景*/ + stop: 0 #113845, + stop: 1.0 #15A8FF); +} +QWidget{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, /*背景*/ + stop: 0 #113845, + stop: 1.0 #15A8FF); +} + +QLabel{ + background:transparent; +} + +QTreeWidget{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, /*背景*/ + stop: 0 #113845, + stop: 1.0 #15A8FF); +} + + +/*--------------------------------------------------以下为菜单的设置---------------------------------------------------------------------------*/ +/*设置整条菜单栏的颜色,现在为橙红色*/ + QMenuBar { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, /*背景*/ + stop: 0 #15A8FF, + stop: 1.0 #113845); + } + + QMenuBar::item { + spacing: 3px; /* spacing between menu bar items */ + padding: 1px 4px; + border-radius: 1px; + font:#BBDDFF; + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, /*菜单最顶层如“Flie”的背景颜色*/ + stop: 0 #113845, + stop: 1.0 #15A8FF); + } + + QMenuBar::item:selected { /* when selected using mouse or keyboard */ + background: #1A2432; /*当鼠标移动到菜单项上面或者通过键盘使菜单项得到光标时显示的颜色*/ + font:#FFFFFF; + } + + QMenuBar::item:pressed { + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #10151E, stop:1 #2C547E); + font:#FFFFFF; + + } + QMenuBar::item:hover{ + border-width:1px; + border-color:#516589; + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #9979A, stop:1 #2D567F); + font:#FFFFFF; + + } + QMenu { + background-color: #030406; /*菜单下拉列表的外边框颜色*/ + border-width:0px; + margin: 2px; /*下拉列表的外边框的宽度*/ + } + + QMenu::item { + background-color: #1D2838; /*如果不加,菜单下拉列表背景颜色默认为黑色*/ + padding: 2px 25px 2px 20px; /*对应每个菜单下拉选项的文字与上一选项的距离,与左边的距离,与下一选项的距离,与右边的距离*/ + border-color:transparent; + color:#858E94; + } + QMenu::item:!enabled { /*当某项菜单不能用时*/ + background-color: #1D2838; + padding: 2px 25px 2px 20px; + border-color:transparent; + color:#76746C; /*字体颜色*/ + } + + QMenu::item:selected { /*当菜单项处于选中状态时选中时*/ + border-width:1px; + border-color: #516589; + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, /*stop有两个,是设置渐变色的关键,由这两个stop的提供的颜色值混合设置渐变色*/ + stop: 0 #1E293A, + stop: 1.0 #2C547E); + color:#E6FFFF; + } + + QMenu::icon:checked { /* appearance of a 'checked' icon */ + background: gray; + border: 1px inset gray; + position: absolute; + top: 1px; + right: 1px; + bottom: 1px; + left: 1px; + } + + QMenu::separator { /*分离器,作用暂时未知*/ + height: 1px; + background: #1D99A9; + /*margin-left: 10px;*/ + /*margin-right: 5px;*/ + } + + QMenu::indicator { /*指示符,作用暂时未知*/ + width: 13px; + height: 13px; + } + + + +/*---------------------------------------------------------------------以下为TabBar的设置-------------------------------------------------------*/ + QTabBar::tab { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #15A8FF, stop: 1.0 #113845); /*当鼠标经过tabbar的上方时所显示的颜色*/ + } +QTabBar::tab:selected{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #113845, stop: 1.0 #15A8FF); /*TabBar的某一个子窗体被选中时,它的最上面的小标题的背景颜色*/ + } +QTabBar::tab:hover { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #15A8FF, stop: 1.0 #113845); /*当鼠标经过tabbar的上方时所显示的颜色*/ + } + + + /*----------------------------------------------------------------------------在MainWindow右下角-------------------------------------------------------------------------------------------------------*/ +QSizeGrip { + + image: url(qss/sizegrip.png); + width: 16px; + height: 16px; + } + + + + /*----------------------------------------------------------------------------在TreeWidget的标题颜色设置-------------------------------------------------------------------------------------------------------*/ + QHeaderView::section { + + background:transparent; /*控件背景透明*/ + border-color: #11505C; /*改变boder的颜色,以便实现动态感觉*/ + border-style: outset; + border-width: 1px; /*boder的长度,有突出效果*/ + border-radius: 1px; + padding: 5px; /*标题宽度*/ + } + + + +/*--------------------------------------------------------------以下为QLineEdit的设置----------------------------------------------------------*/ + + +QLineEdit,QTextEdit { + border: 1px solid #32435E; + border-radius: 5px; /*控件边框的弧度,数值越大,则弯曲得越厉害*/ + /* padding: 0 8px; */ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, /*背景*/ + stop: 0 #113845, + stop: 1.0 #15A8FF); + selection-background-color: #0A246A; + +} +QLineEdit::hover{ + border-color:#5D8B9E; /*外边框的颜色*/ +} + +QLineEdit[echoMode="3"] { + lineedit-password-character: 9679; +} + +#QLineEdit:read-only { + background: #543F7C; +} + + + +/*-----------------------------------------------------------以下设置特定QToolButton的属性-----------------------------------------------------*/ + + +QToolButton[objectName="minimizeToolBtn"] { /*为特定控件名的按钮单独设置属性*/ + background: transparent; + border:none; + image:url(qss/minimize.png) +} +QToolButton[objectName="minimizeToolBtn"]:hover,QToolButton[objectName="minimizeToolBtn"]:pressed {/*为特定控件名的按钮单独设置属性*/ + image:url(qss/minimize_hover.png) +} + + + + +/*---------------------------------------------------------以下设置pushbutton的样式-------------------------------------------------*/ +QPushButton{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, /*三个坐标对应的是上。中。下的background的颜色*/ + stop: 0 #122C39, stop: 0.5 #758385, + stop: 1.0 #15A8FF); + border-color: #11505C; /*改变boder的颜色,以便实现动态感觉*/ + border-style: outset; + border-width: 5px; /*boder的长度,有突出效果*/ + border-radius: 1px; + padding: 1px; +} + +QPushButton::hover{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #5B5F5F, stop: 0.5 #0C2436, + stop: 1.0 #27405A); + border-color: #11223F; /*boder的颜色,boder跟background做对比设置可以有较明显效果*/ + +} + +QPushButton::pressed{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #969B9C, stop: 0.5 #16354B, + stop: 1.0 #244F76); + border-color: #11505C; +} +QPushButton::disabled{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #282B2C, stop: 0.5 #09121A, + stop: 1.0 #111D29); + border-color: #0A1320; + color:#6A6864; + +} + + + +QDialog QPushButton,QDialog QToolButton{ + min-width:30px; + min-height:23px; +} + +/*----------------------------------------------------------------以下设置QToolButton------------------------------------------------------*/ + QToolButton{ + min-width:30px; + min-height:23px; +} + +/*----------------------------------------------------------------以下设置QComboBox------------------------------------------------------*/ + + +QComboBox { + min-width: 6em; + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, /*三个坐标对应的是上。中。下的background的颜色*/ + stop: 0 #122C39, stop: 0.5 #758385, + stop: 1.0 #15A8FF); + border-color: #11505C; /*改变boder的颜色,以便实现动态感觉*/ + border-style: outset; + border-width: 5px; /*boder的长度,有突出效果*/ + border-radius: 1px; + padding: 1px; + } +QComboBox::hover{ + border-color:#5D8B9E; +} + + + QComboBox:editable { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #080B10, + stop: 1.0 #212C3F); + } + + QComboBox:!editable, QComboBox::drop-down:editable { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #080B10, + stop: 1.0 #212C3F); + } + + /* QComboBox gets the "on" state when the popup is open */ + QComboBox:!editable:on, QComboBox::drop-down:editable:on { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #080B10, + stop: 1.0 #212C3F);; + } + + QComboBox:on { /* shift the text when the popup opens */ + padding-top: 3px; + padding-left: 4px; + } + QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 15px; + + border-left-width: 1px; + border-left-color: 32435E; + border-left-style: solid; /* just a single line */ + border-top-right-radius: 3px; /* same radius as the QComboBox */ + border-bottom-right-radius: 3px; + } + + QComboBox::down-arrow { + image: url(qss/downarrow.png); + } + + QComboBox::down-arrow:on { /* shift the arrow when popup is open */ + top: 1px; + left: 1px; + } + + QComboBox QAbstractItemView { + border: 2px solid #32435E; + selection-background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #506B79, + stop: 1.0 #0D95A6); + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #1B2534, stop: 0.4 #010101, + stop: 0.5 #000101, stop: 1.0 #1F2B3C); + } + +/*--------------------------------------------------设置QStatusBar---------------------------------------------------------------------------*/ + QStatusBar { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, /*背景*/ + stop: 0 #113845, + stop: 1.0 #15A8FF); + } + + QStatusBar::item { + border: 1px solid #3E58A5; + border-radius: 3px; + } + +#QStatusBar QLabel { + border: 1px solid #6AF0FF; + /*background: white; */ +} + +/*-----------------------------------------------------------以下设置checkbox--------------------------------------------------------------*/ +QCheckBox { + spacing: 5px; + background:transparent; /*控件背景透明*/ + } + + QCheckBox::indicator { + width: 13px; + height: 13px; + } + + QCheckBox::indicator:unchecked { + image: url(:/qss/checkbox_unchecked.png); + } + + QCheckBox::indicator:unchecked:hover { + image: url(:/qss/checkbox_unchecked_hover.png); + } + + QCheckBox::indicator:unchecked:pressed { + image: url(:/qss/checkbox_unchecked_pressed.png); + } + + QCheckBox::indicator:checked { + image: url(:/qss/checkbox_checked.png); + } + + QCheckBox::indicator:checked:hover { + image: url(:/qss/checkbox_checked_hover.png); + } + + QCheckBox::indicator:checked:pressed { + image: url(:/qss/checkbox_checked_pressed.png); + } + + QCheckBox::indicator:indeterminate:hover { + image: url(:/qss/checkbox_indeterminate_hover.png); + } + + QCheckBox::indicator:indeterminate:pressed { + image: url(:/qss/checkbox_indeterminate_pressed.png); + } + + +/*-----------------------------------------------------------以下设置QRadioButton-----------------------------------------------------------*/ + + QRadioButton { + width: 13px; + height: 13px; + background:transparent; + } + + QRadioButton::indicator { + width: 13px; + height: 13px; + background:transparent; + } + + QRadioButton::indicator::unchecked { + image: url(qss/radiobutton_unchecked.png); + } + + QRadioButton::indicator:unchecked:hover { + image: url(qss/radiobutton_unchecked_hover.png); + } + + QRadioButton::indicator:unchecked:pressed { + image: url(qss/radiobutton_unchecked_pressed.png); + } + + QRadioButton::indicator::checked { + image: url(qss/radiobutton_checked.png); + } + + QRadioButton::indicator:checked:hover { + image: url(qss/radiobutton_checked_hover.png); + } + + QRadioButton::indicator:checked:pressed { + image: url(qss/radiobutton_checked_pressed.png); + } + + +/*--------------------------------------------------------以下设置QScrollBar------------------------------------------------------*/ + +QScrollBar:vertical { /*垂直的QScrollBar*/ + border: 1px solid #32435E; + border-width: 0px 0px 0px 1px; + background: #21252F; + width: 12px; + margin: 12px 0 12px 0; + } + QScrollBar::handle:vertical { /*handle处理*/ + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #60788C, stop:1 #1084BD); + min-height: 20px; + } + QScrollBar::add-line:vertical { + border: 1px solid #32435E; + border-width:0px 0px 0px 1px; + background:#21252F; + height: 12px; + subcontrol-position: bottom; + subcontrol-origin: margin; + } + + QScrollBar::sub-line:vertical { + border: 1px solid #32435E; + border-width:0px 0px 0px 1px; + background: #21252F; + height: 12px; + subcontrol-position: top; + subcontrol-origin: margin; + } + QScrollBar::up-arrow:vertical { + border: 1px solid transparent; + background: #21252F; + image: url(qss/up_arrow.png); + width: 7px; + height: 7px; + } + QScrollBar::up-arrow:vertical:hover,QScrollBar::up-arrow:vertical:pressed { + image: url(qss/up_arrow_hover.png); + } + + QScrollBar::down-arrow:vertical{ + border: 1px solid transparent; + background: #21252F; + image:url(qss/down_arrow.png); + width: 7px; + height: 7px; + } +QScrollBar::down-arrow:vertical:hover,QScrollBar::down-arrow:vertical:pressed{ + image: url(qss/down_arrow_hover.png); +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} + + + QScrollBar:horizontal { /*水平的QScrollBar*/ + border: 1px solid #32435E; + border-width: 1px 0px 0px 0px; + background: #21252F; + height: 12px; + margin: 0 12px 0 12px; + } + QScrollBar::handle:horizontal { + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #60788C, stop:1 #1084BD); + min-width: 20px; + } + QScrollBar::add-line:horizontal { + border: 1px solid #32435E; + border-width:1px 0px 0px 0px; + background:#21252F; + width: 12px; + subcontrol-position: right; + subcontrol-origin: margin; + } + + QScrollBar::sub-line:horizontal { + border: 1px solid #32435E; + + + border-width:1px 0px 0px 0px; + background: #21252F; + width: 12px; + subcontrol-position: left; + subcontrol-origin: margin; + } + QScrollBar::left-arrow:horizontal { + border: 1px solid transparent; + background: #21252F; + image: url(qss/left_arrow.png); + width: 7px; + height: 7px; + } + QScrollBar::left-arrow:horizontal:hover,QScrollBar::left-arrow:horizontal:pressed { + image: url(qss/left_arrow_hover.png); + } + + QScrollBar::right-arrow:horizontal{ + border: 1px solid transparent; + background: #21252F; + image:url(qss/right_arrow.png); + width: 7px; + height: 7px; + } +QScrollBar::right-arrow:horizontal:hover,QScrollBar::right-arrow:horizontal:pressed{ + image: url(qss/right_arrow_hover.png); +} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} + + + + + diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/14.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/14.qss new file mode 100644 index 0000000..3b374f1 --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/14.qss @@ -0,0 +1,148 @@ +QFrame { + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0.960396, y2:0.949, stop:0 rgba(88, 245, 227, 255), stop:0.0940594 rgba(132, 246, 239, 255), stop:0.143564 rgba(130, 246, 233, 255), stop:0.222772 rgba(158, 249, 234, 255), stop:0.25 rgba(144, 248, 248, 255), stop:0.292079 rgba(173, 251, 252, 255), stop:0.326733 rgba(156, 248, 241, 255), stop:0.475248 rgba(158, 230, 226, 255), stop:0.554455 rgba(135, 251, 242, 255), stop:0.628713 rgba(139, 226, 226, 255), stop:0.805 rgba(150, 245, 242, 255), stop:0.866337 rgba(186, 254, 243, 255), stop:0.915842 rgba(188, 254, 250, 255), stop:1 rgba(190, 255, 248, 255)); + color: rgb(0, 0, 0); + font: 75 11pt "Bitstream Charter"; + +} + +QMainWindow{ + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0.960396, y2:0.949, stop:0 rgba(88, 245, 227, 255), stop:0.0940594 rgba(132, 246, 239, 255), stop:0.143564 rgba(130, 246, 233, 255), stop:0.222772 rgba(158, 249, 234, 255), stop:0.25 rgba(144, 248, 248, 255), stop:0.292079 rgba(173, 251, 252, 255), stop:0.326733 rgba(156, 248, 241, 255), stop:0.475248 rgba(158, 230, 226, 255), stop:0.554455 rgba(135, 251, 242, 255), stop:0.628713 rgba(139, 226, 226, 255), stop:0.805 rgba(150, 245, 242, 255), stop:0.866337 rgba(186, 254, 243, 255), stop:0.915842 rgba(188, 254, 250, 255), stop:1 rgba(190, 255, 248, 255)); + color: rgb(0, 0, 0); + font: 75 11pt "Bitstream Charter"; + +} + +QWidget{ + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0.960396, y2:0.949, stop:0 rgba(88, 245, 227, 255), stop:0.0940594 rgba(132, 246, 239, 255), stop:0.143564 rgba(130, 246, 233, 255), stop:0.222772 rgba(158, 249, 234, 255), stop:0.25 rgba(144, 248, 248, 255), stop:0.292079 rgba(173, 251, 252, 255), stop:0.326733 rgba(156, 248, 241, 255), stop:0.475248 rgba(158, 230, 226, 255), stop:0.554455 rgba(135, 251, 242, 255), stop:0.628713 rgba(139, 226, 226, 255), stop:0.805 rgba(150, 245, 242, 255), stop:0.866337 rgba(186, 254, 243, 255), stop:0.915842 rgba(188, 254, 250, 255), stop:1 rgba(190, 255, 248, 255)); + color: rgb(0, 0, 0); + font: 75 11pt "Bitstream Charter"; +} + +QMenu{ + color: rgb(0, 0, 0); + font: 75 11pt "Bitstream Charter"; +background-color: qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0 rgba(35, 40, 3, 255), stop:0.16 rgba(136, 106, 22, 255), stop:0.225 rgba(166, 140, 41, 255), stop:0.285 rgba(204, 181, 74, 255), stop:0.345 rgba(235, 219, 102, 255), stop:0.415 rgba(245, 236, 112, 255), stop:0.52 rgba(209, 190, 76, 255), stop:0.57 rgba(187, 156, 51, 255), stop:0.635 rgba(168, 142, 42, 255), stop:0.695 rgba(202, 174, 68, 255), stop:0.75 rgba(218, 202, 86, 255), stop:0.815 rgba(208, 187, 73, 255), stop:0.88 rgba(187, 156, 51, 255), stop:0.935 rgba(137, 108, 26, 255), stop:1 rgba(35, 40, 3, 255)); + border-width: 2px; + border-color: rgb(255, 255, 255); + border-style: solid; + border-radius: 8; + padding: 5px; + +} + + +QTreeView{ + background-color: rgb(255, 252, 144); + border-width: 2px; + border-color: rgb(255, 255, 255); + border-style: solid; + border-radius: 10; + color: rgb(0, 0, 0); + font: 75 11pt "Bitstream Charter"; +} + + +QPushButton { + color: rgb(0, 0, 0); + font: 75 11pt "Bitstream Charter"; + border-width: 2px; + background-color: rgb(170, 170, 0); + border-style: solid; + border-radius: 10; + padding: 3px; + min-width: 9ex; + min-height: 2.5ex; +} + +QPushButton:hover { + + padding-left: 5px; + padding-top: 5px; +} + +QPushButton:pressed { + color:white; + +} + + +QLabel { + color: rgb(0, 0, 0); + font: 75 11pt "Bitstream Charter"; +} + +QLineEdit{ + color: rgb(0, 0, 0); + font: 75 11pt "Bitstream Charter"; + background-color: rgb(255, 252, 144); + border-width: 2px; + border-color: rgb(255, 255, 255); + border-style: solid; + border-radius: 5; + padding: 3px; +} + + +QComboBox{ + color: rgb(0, 0, 0); + font: 75 11pt "Bitstream Charter"; + border-width: 2px; + background-color: rgb(170, 170, 0); + border-color: rgb(255, 255, 255); + border-style: solid; + border-radius: 5; +} +QComboBox:hover{ + +} + +QDoubleSpinBox { + color: rgb(0, 0, 0); + font: 75 11pt "Bitstream Charter"; + border-width: 2px; + background-color: rgb(170, 170, 0); + border-color: rgb(255, 255, 255); + border-style: solid; + border-radius: 5; + +} + + +QCheckBox{ + color: rgb(0, 0, 0); + font: 75 11pt "Bitstream Charter"; + border-width: 2px; + background-color: rgb(170, 170, 0); + border-color: rgb(255, 255, 255); + border-style: solid; + border-radius: 5; +} +QCheckBox:hover{ + color:white; +} +QCheckBox:checked{ + +} + + + +QRadioButton{ + color: rgb(0, 0, 0); + font: 75 11pt "Bitstream Charter"; + border-width: 2px; + background-color: rgb(170, 170, 0); + border-color: rgb(255, 255, 255); + border-style: solid; + border-radius: 5; +} +QRadioButton:checked { + +} +QRadioButton:hover { + color:white; +} + + + + + diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/15.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/15.qss new file mode 100644 index 0000000..5a50878 --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/15.qss @@ -0,0 +1,161 @@ +QFrame { + background-color: rgb(79, 149, 255); + color:black; + font: 75 12pt "Century Schoolbook L"; + +} + +QMainWindow{ + background-color: rgb(79, 149, 255); + color:black; + border-style: solid; + border-radius: 10; + font: 75 12pt "Century Schoolbook L"; +} + +QWidget{ + + background-color: rgb(79, 149, 255); + color:black; + border-style: solid; + border-radius: 10; + font: 75 12pt "Century Schoolbook L"; + +} + +QMenu{ + color:white; + background-color: rgb(79, 149, 255); + border-width: 2px; + border-color: seagreen; + border-style: solid; + border-radius: 8; + padding: 5px; + font: italic 12pt "URW Chancery L"; + +} + +QSpinBox{ + background-color: white; + color:black; + border-radius: 5; + padding: 3px; + min-width: 9ex; + min-height: 2.5ex; + font: 75 12pt "Century Schoolbook L"; + +} + + +QTreeView{ + color:black; + background-color: rgb(79, 149, 255); + border-width: 2px; + border-color: seagreen; + border-style: solid; + border-radius: 10; + font: 75 12pt "Century Schoolbook L"; +} + +QComboBox{ + background-color: yellowgreen; + border-width: 2px; + border-color: seagreen; + border-style: solid; + border-radius: 5; + font: italic 12pt "URW Chancery L"; +} +QComboBox:hover{ + background-color: qlineargradient(spread:repeat, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(130, 111, 111, 255), stop:1 rgba(255, 255, 255, 255)); +} + + +QPushButton { + color:black; + background-color: qlineargradient(spread:pad, x1:0.536868, y1:0, x2:0.524, y2:1, stop:0 rgba(90, 90, 90, 255), stop:0.51752 rgba(255, 255, 255, 255), stop:1 rgba(0, 0, 0, 255)); + border-width: 2px; + border-color: seagreen; + border-style: solid; + border-radius: 10; + padding: 3px; + min-width: 9ex; + min-height: 2.5ex; + font: 75 12pt "Century Schoolbook L"; +} + +QPushButton:hover { + background-color: qlineargradient(spread:repeat, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(130, 111, 111, 255), stop:1 rgba(255, 255, 255, 255)); +} + +QPushButton:pressed { + padding-left: 5px; + padding-top: 5px; + background-color: qlineargradient(spread:reflect, x1:0.908727, y1:0.069, x2:1, y2:0, stop:0 rgba(53, 85, 11, 255), stop:1 rgba(255, 255, 255, 255)); +} + +QLineEdit{ + + background-color: white; + border-width: 2px; + border-color: seagreen; + border-style: solid; + border-radius: 10; + padding: 3px; +} + + + +QLabel { + color:white; +} + + + +QDoubleSpinBox { + color:white; + background-color: yellowgreen; + border-width: 2px; + border-color: seagreen; + border-style: solid; + border-radius:5; + +} + + +QCheckBox{ + color:black; + background-color: qlineargradient(spread:pad, x1:0.536868, y1:0, x2:0.524, y2:1, stop:0 rgba(90, 90, 90, 255), stop:0.51752 rgba(255, 255, 255, 255), stop:1 rgba(0, 0, 0, 255)); + border-width: 2px; + border-color: seagreen; + border-style: solid; + border-radius: 5; + padding: 3px; + min-width: 9ex; + min-height: 2.5ex; +} +QCheckBox:hover{ + background-color: qlineargradient(spread:repeat, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(130, 111, 111, 255), stop:1 rgba(255, 255, 255, 255)); +} +QCheckBox:checked{ + color: rgb(12, 1, 170); +} + + + +QRadioButton{ + color:white; + background-color: yellowgreen; + border-width: 2px; + border-color: seagreen; + border-style: solid; + border-radius: 10; + padding: 3px; +} +QRadioButton:checked { + color: rgb(12, 1, 170); +} +QRadioButton:hover { + color:white; + background-color: qlineargradient(spread:repeat, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(130, 111, 111, 255), stop:1 rgba(255, 255, 255, 255)); +} + diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/16.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/16.qss new file mode 100644 index 0000000..2f127e7 --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/16.qss @@ -0,0 +1,564 @@ +/* +Ubuntu Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 09/10/2019 (dd/mm/yyyy), 12:31. +Available at: https://github.com/GTRONICK/QSS/blob/master/Ubuntu.qss +*/ +QMainWindow { + background-color:#f0f0f0; +} +QCheckBox { + padding:2px; +} +QCheckBox:hover { + border-radius:4px; + border-style:solid; + border-width:1px; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-color: rgb(255,150,60); + background-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(190, 90, 50, 50), stop:1 rgba(250, 130, 40, 50)); +} +QCheckBox::indicator:checked { + border-radius:4px; + border-style:solid; + border-width:1px; + border-color: rgb(246, 134, 86); + background-color:rgb(246, 134, 86) +} +QCheckBox::indicator:unchecked { + border-radius:4px; + border-style:solid; + border-width:1px; + border-color:rgb(246, 134, 86); + background-color:rgb(255,255,255); +} +QColorDialog { + background-color:#f0f0f0; +} +QComboBox { + color:rgb(81,72,65); + background: #ffffff; +} +QComboBox:editable { + background: #ffffff; + color: rgb(81,72,65); + selection-color:rgb(81,72,65); + selection-background-color: #ffffff; +} +QComboBox QAbstractItemView { + color:rgb(81,72,65); + background: #ffffff; + selection-color: #ffffff; + selection-background-color: rgb(246, 134, 86); +} +QComboBox:!editable:on, QComboBox::drop-down:editable:on { + color: #1e1d23; + background: #ffffff; +} +QDateTimeEdit { + color:rgb(81,72,65); + background-color: #ffffff; +} +QDateEdit { + color:rgb(81,72,65); + background-color: #ffffff; +} +QDialog { + background-color:#f0f0f0; +} +QDoubleSpinBox { + color:rgb(81,72,65); + background-color: #ffffff; +} +QFontComboBox { + color:rgb(81,72,65); + background-color: #ffffff; +} +QLabel { + color:rgb(17,17,17); +} +QLineEdit { + background-color:rgb(255,255,255); + selection-background-color:rgb(236,116,64); + color:rgb(17,17,17); +} +QMenuBar { + color:rgb(223,219,210); + background-color:rgb(65,64,59); +} +QMenuBar::item { + padding-top:4px; + padding-left:4px; + padding-right:4px; + color:rgb(223,219,210); + background-color:rgb(65,64,59); +} +QMenuBar::item:selected { + color:rgb(255,255,255); + padding-top:2px; + padding-left:2px; + padding-right:2px; + border-top-width:2px; + border-left-width:2px; + border-right-width:2px; + border-top-right-radius:4px; + border-top-left-radius:4px; + border-style:solid; + background-color:rgb(65,64,59); + border-top-color: rgb(47,47,44); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(90, 87, 78, 255), stop:1 rgba(47,47,44, 255)); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 rgba(90, 87, 78, 255), stop:1 rgba(47,47,44, 255)); +} +QMenu { + color:rgb(223,219,210); + background-color:rgb(65,64,59); +} +QMenu::item { + color:rgb(223,219,210); + padding-left:20px; + padding-top:4px; + padding-bottom:4px; + padding-right:10px; +} +QMenu::item:selected { + color:rgb(255,255,255); + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(225, 108, 54, 255), stop:1 rgba(246, 134, 86, 255)); + border-style:solid; + border-width:3px; + padding-left:17px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; + border-bottom-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(175,85,48,255), stop:1 rgba(236,114,67, 255)); + border-top-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); + border-right-color:qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); + border-left-color:qlineargradient(spread:pad, x1:1, y1:0.5, x2:0, y2:0.5, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); +} +QPlainTextEdit { + border-width: 1px; + border-style: solid; + border-color:transparent; + color:rgb(17,17,17); + selection-background-color:rgb(236,116,64); +} +QProgressBar { + text-align: center; + color: rgb(0, 0, 0); + border-width: 1px; + border-radius: 10px; + border-style: inset; + border-color: rgb(150,150,150); + background-color:rgb(221,221,219); +} +QProgressBar::chunk:horizontal { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(225, 108, 54, 255), stop:1 rgba(246, 134, 86, 255)); + border-style: solid; + border-radius:8px; + border-width:1px; + border-bottom-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(175,85,48,255), stop:1 rgba(236,114,67, 255)); + border-top-color:qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); + border-right-color:qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); + border-left-color:qlineargradient(spread:pad, x1:1, y1:0.5, x2:0, y2:0.5, stop:0 rgba(253,156,113,255), stop:1 rgba(205,90,46, 255)); +} +QPushButton{ + color:rgb(17,17,17); + border-width: 1px; + border-radius: 6px; + border-bottom-color: rgb(150,150,150); + border-right-color: rgb(165,165,165); + border-left-color: rgb(165,165,165); + border-top-color: rgb(180,180,180); + border-style: solid; + padding: 4px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(220, 220, 220, 255), stop:1 rgba(255, 255, 255, 255)); +} +QPushButton:hover{ + color:rgb(17,17,17); + border-width: 1px; + border-radius:6px; + border-top-color: rgb(255,150,60); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 255)); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 255)); + border-bottom-color: rgb(200,70,20); + border-style: solid; + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(220, 220, 220, 255), stop:1 rgba(255, 255, 255, 255)); +} +QPushButton:default{ + color:rgb(17,17,17); + border-width: 1px; + border-radius:6px; + border-top-color: rgb(255,150,60); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 255)); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 255)); + border-bottom-color: rgb(200,70,20); + border-style: solid; + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(220, 220, 220, 255), stop:1 rgba(255, 255, 255, 255)); +} +QPushButton:pressed{ + color:rgb(17,17,17); + border-width: 1px; + border-radius: 6px; + border-width: 1px; + border-top-color: rgba(255,150,60,200); + border-right-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 200)); + border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 rgba(200, 70, 20, 255), stop:1 rgba(255,150,60, 200)); + border-bottom-color: rgba(200,70,20,200); + border-style: solid; + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(220, 220, 220, 255), stop:1 rgba(255, 255, 255, 255)); +} +QPushButton:disabled{ + color:rgb(174,167,159); + border-width: 1px; + border-radius: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(200, 200, 200, 255), stop:1 rgba(230, 230, 230, 255)); +} +QRadioButton { + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: rgba(246, 134, 86, 255); + color: #a9b7c6; + background-color:rgba(246, 134, 86, 255); +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: rgb(246, 134, 86); + color: #a9b7c6; + background-color: transparent; +} +QScrollArea { + color: #FFFFFF; + background-color:#f0f0f0; +} +QSlider::groove { + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); +} +QSlider::groove:horizontal { + height: 5px; + background: rgb(246, 134, 86); +} +QSlider::groove:vertical { + width: 5px; + background: rgb(246, 134, 86); +} +QSlider::handle:horizontal { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + width: 12px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + height: 12px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal { + background: white; +} +QSlider::add-page:vertical { + background: white; +} +QSlider::sub-page:horizontal { + background: rgb(246, 134, 86); +} +QSlider::sub-page:vertical { + background: rgb(246, 134, 86); +} +QStatusBar { + color:rgb(81,72,65); +} +QSpinBox { + color:rgb(81,72,65); + background-color: #ffffff; +} +QScrollBar:horizontal { + max-height: 20px; + border: 1px transparent grey; + margin: 0px 20px 0px 20px; +} +QScrollBar::handle:horizontal { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + border-radius: 7px; + min-width: 25px; +} +QScrollBar::handle:horizontal:hover { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(255,150,60); + border-radius: 7px; + min-width: 25px; +} +QScrollBar::add-line:horizontal { + border: 1px solid; + border-color: rgb(207,207,207); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-right-radius: 7px; + background: rgb(255, 255, 255); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:hover { + border: 1px solid; + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-right-radius: 7px; + border-color: rgb(255,150,60); + background: rgb(255, 255, 255); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:pressed { + border: 1px solid grey; + border-top-left-radius: 7px; + border-top-right-radius: 7px; + border-bottom-right-radius: 7px; + background: rgb(231,231,231); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal { + border: 1px solid; + border-color: rgb(207,207,207); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(255, 255, 255); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:hover { + border: 1px solid; + border-color: rgb(255,150,60); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(255, 255, 255); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:pressed { + border: 1px solid grey; + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(231,231,231); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::left-arrow:horizontal { + border: 1px transparent grey; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; + width: 6px; + height: 6px; + background: rgb(230,230,230); +} +QScrollBar::right-arrow:horizontal { + border: 1px transparent grey; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; + width: 6px; + height: 6px; + background: rgb(230,230,230); +} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} +QScrollBar:vertical { + max-width: 20px; + border: 1px transparent grey; + margin: 20px 0px 20px 0px; +} +QScrollBar::add-line:vertical { + border: 1px solid; + border-color: rgb(207,207,207); + border-bottom-right-radius: 7px; + border-bottom-left-radius: 7px; + border-top-left-radius: 7px; + background: rgb(255, 255, 255); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:hover { + border: 1px solid; + border-color: rgb(255,150,60); + border-bottom-right-radius: 7px; + border-bottom-left-radius: 7px; + border-top-left-radius: 7px; + background: rgb(255, 255, 255); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:pressed { + border: 1px solid grey; + border-bottom-left-radius: 7px; + border-bottom-right-radius: 7px; + border-top-left-radius: 7px; + background: rgb(231,231,231); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical { + border: 1px solid; + border-color: rgb(207,207,207); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(255, 255, 255); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:hover { + border: 1px solid; + border-color: rgb(255,150,60); + border-top-right-radius: 7px; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(255, 255, 255); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:pressed { + border: 1px solid grey; + border-top-left-radius: 7px; + border-top-right-radius: 7px; + background: rgb(231,231,231); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::handle:vertical { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + border-radius: 7px; + min-height: 25px; +} +QScrollBar::handle:vertical:hover { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(255,150,60); + border-radius: 7px; + min-height: 25px; +} +QScrollBar::up-arrow:vertical { + border: 1px transparent grey; + border-top-left-radius: 3px; + border-top-right-radius: 3px; + width: 6px; + height: 6px; + background: rgb(230,230,230); +} +QScrollBar::down-arrow:vertical { + border: 1px transparent grey; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + width: 6px; + height: 6px; + background: rgb(230,230,230); +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} +QTabWidget { + color:rgb(0,0,0); + background-color:rgb(247,246,246); +} +QTabWidget::pane { + border-color: rgb(180,180,180); + background-color:rgb(247,246,246); + border-style: solid; + border-width: 1px; + border-radius: 6px; +} +QTabBar::tab { + padding-left:4px; + padding-right:4px; + padding-bottom:2px; + padding-top:2px; + color:rgb(81,72,65); + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(221,218,217,255), stop:1 rgba(240,239,238,255)); + border-style: solid; + border-width: 1px; + border-top-right-radius:4px; + border-top-left-radius:4px; + border-top-color: rgb(180,180,180); + border-left-color: rgb(180,180,180); + border-right-color: rgb(180,180,180); + border-bottom-color: transparent; +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + background-color:rgb(247,246,246); + margin-left: 0px; + margin-right: 1px; +} +QTabBar::tab:!selected { + margin-top: 1px; + margin-right: 1px; +} +QTextEdit { + border-width: 1px; + border-style: solid; + border-color:transparent; + color:rgb(17,17,17); + selection-background-color:rgb(236,116,64); +} +QTimeEdit { + color:rgb(81,72,65); + background-color: #ffffff; +} +QToolBox { + color:rgb(81,72,65); + background-color: #ffffff; +} +QToolBox::tab { + color:rgb(81,72,65); + background-color: #ffffff; +} +QToolBox::tab:selected { + color:rgb(81,72,65); + background-color: #ffffff; +} diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/17.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/17.qss new file mode 100644 index 0000000..e7cecf2 --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/17.qss @@ -0,0 +1,968 @@ +/* +* The MIT License (MIT) +* +* Copyright : http://blog.csdn.net/liang19890820 +* +* Author : 一去丶二三里 +* +* Date : 2016/07/22 +* +* Description : 白色靓丽 +* +*/ + +/**********子界面背景**********/ +QWidget#customWidget { + background: rgb(173, 202, 232); +} + +/**********子界面中央背景**********/ +QWidget#centerWidget { + background: rgb(232, 241, 252); +} + +/**********主界面样式**********/ +QWidget#mainWindow { + border: 1px solid rgb(111, 156, 207); + background: rgb(232, 241, 252); +} + +QWidget#messageWidget { + background: rgba(173, 202, 232, 50%); +} + +QWidget#loadingWidget { + border: none; + border-radius: 5px; + background: rgb(187, 212, 238); +} + +QWidget#remoteWidget { + border-top-right-radius: 10px; + border-bottom-right-radius: 10px; + border: 1px solid rgb(111, 156, 207); + border-left: none; + background: transparent; +} + +StyledWidget { + qproperty-normalColor: rgb(65, 65, 65); + qproperty-disableColor: rgb(180, 180, 180); + qproperty-highlightColor: rgb(0, 160, 230); + qproperty-errorColor: red; +} + +QProgressIndicator { + qproperty-color: rgb(2, 65, 132); +} + +/**********提示**********/ +QToolTip{ + border: 1px solid rgb(111, 156, 207); + background: white; + color: rgb(51, 51, 51); +} + +/**********菜单栏**********/ +QMenuBar { + background: rgb(187, 212, 238); + border: 1px solid rgb(111, 156, 207); + border-left: none; + border-right: none; +} +QMenuBar::item { + border: 1px solid transparent; + padding: 5px 10px 5px 10px; + background: transparent; +} +QMenuBar::item:enabled { + color: rgb(2, 65, 132); +} +QMenuBar::item:!enabled { + color: rgb(155, 155, 155); +} +QMenuBar::item:enabled:selected { + border-top-color: rgb(111, 156, 207); + border-bottom-color: rgb(111, 156, 207); + background: rgb(198, 224, 252); +} + +/**********菜单**********/ +QMenu { + border: 1px solid rgb(111, 156, 207); + background: rgb(232, 241, 250); +} +QMenu::item { + height: 22px; + padding: 0px 25px 0px 20px; +} +QMenu::item:enabled { + color: rgb(84, 84, 84); +} +QMenu::item:!enabled { + color: rgb(155, 155, 155); +} +QMenu::item:enabled:selected { + color: rgb(2, 65, 132); + background: rgba(255, 255, 255, 200); +} +QMenu::separator { + height: 1px; + background: rgb(111, 156, 207); +} +QMenu::indicator { + width: 13px; + height: 13px; +} +QMenu::icon { + padding-left: 2px; + padding-right: 2px; +} + +/**********状态栏**********/ +QStatusBar { + background: rgb(187, 212, 238); + border: 1px solid rgb(111, 156, 207); + border-left: none; + border-right: none; + border-bottom: none; +} +QStatusBar::item { + border: none; + border-right: 1px solid rgb(111, 156, 207); +} + +/**********分组框**********/ +QGroupBox { + font-size: 15px; + border: 1px solid rgb(111, 156, 207); + border-radius: 4px; + margin-top: 10px; +} +QGroupBox::title { + color: rgb(56, 99, 154); + top: -12px; + left: 10px; +} + +/**********页签项**********/ +QTabWidget::pane { + border: none; + border-top: 3px solid rgb(0, 78, 161); + background: rgb(187, 212, 238); +} +QTabWidget::tab-bar { + border: none; +} +QTabBar::tab { + border: none; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + color: white; + background: rgb(120, 170, 220); + height: 28px; + min-width: 85px; + margin-right: 5px; + padding-left: 5px; + padding-right: 5px; +} +QTabBar::tab:hover { + background: rgb(0, 78, 161); +} +QTabBar::tab:selected { + color: white; + background: rgb(0, 78, 161); +} + +QTabWidget#tabWidget::pane { + border: 1px solid rgb(111, 156, 207); + background: rgb(232, 241, 252); + margin-top: -1px; +} + +QTabBar#tabBar::tab { + border: 1px solid rgb(111, 156, 207); + border-bottom: none; + color: rgb(70, 71, 73); + background: transparent; +} +QTabBar#tabBar::tab:hover { + color: rgb(2, 65, 132); +} +QTabBar#tabBar::tab:selected { + color: rgb(2, 65, 132); + background: rgb(232, 241, 252); +} + +/**********表头**********/ +QHeaderView{ + border: none; + border-bottom: 3px solid rgb(0, 78, 161); + background: transparent; + min-height: 30px; +} +QHeaderView::section:horizontal { + border: none; + color: rgb(2, 65, 132); + background: transparent; + padding-left: 5px; +} +QHeaderView::section:horizontal:hover { + color: white; + background: rgb(0, 78, 161); +} +QHeaderView::section:horizontal:pressed { + color: white; + background: rgb(6, 94, 187); +} +QHeaderView::up-arrow { + width: 13px; + height: 11px; + padding-right: 5px; + image: url(:/White/topArrow); + subcontrol-position: center right; +} +QHeaderView::up-arrow:hover, QHeaderView::up-arrow:pressed { + image: url(:/White/topArrowHover); +} +QHeaderView::down-arrow { + width: 13px; + height: 11px; + padding-right: 5px; + image: url(:/White/bottomArrow); + subcontrol-position: center right; +} +QHeaderView::down-arrow:hover, QHeaderView::down-arrow:pressed { + image: url(:/White/bottomArrowHover); +} + +/**********表格**********/ +QTableView { + border: 1px solid rgb(111, 156, 207); + background: rgb(224, 238, 255); + gridline-color: rgb(111, 156, 207); +} +QTableView::item { + padding-left: 5px; + padding-right: 5px; + border: none; + background: white; + border-right: 1px solid rgb(111, 156, 207); + border-bottom: 1px solid rgb(111, 156, 207); +} +QTableView::item:selected { + background: rgba(255, 255, 255, 100); +} +QTableView::item:selected:!active { + color: rgb(65, 65, 65); +} +QTableView::indicator { + width: 20px; + height: 20px; +} +QTableView::indicator:enabled:unchecked { + image: url(:/White/checkBox); +} +QTableView::indicator:enabled:unchecked:hover { + image: url(:/White/checkBoxHover); +} +QTableView::indicator:enabled:unchecked:pressed { + image: url(:/White/checkBoxPressed); +} +QTableView::indicator:enabled:checked { + image: url(:/White/checkBoxChecked); +} +QTableView::indicator:enabled:checked:hover { + image: url(:/White/checkBoxCheckedHover); +} +QTableView::indicator:enabled:checked:pressed { + image: url(:/White/checkBoxCheckedPressed); +} +QTableView::indicator:enabled:indeterminate { + image: url(:/White/checkBoxIndeterminate); +} +QTableView::indicator:enabled:indeterminate:hover { + image: url(:/White/checkBoxIndeterminateHover); +} +QTableView::indicator:enabled:indeterminate:pressed { + image: url(:/White/checkBoxIndeterminatePressed); +} + +/**********滚动条-水平**********/ +QScrollBar:horizontal { + height: 20px; + background: transparent; + margin-top: 3px; + margin-bottom: 3px; +} +QScrollBar::handle:horizontal { + height: 20px; + min-width: 30px; + background: rgb(170, 200, 230); + margin-left: 15px; + margin-right: 15px; +} +QScrollBar::handle:horizontal:hover { + background: rgb(165, 195, 225); +} +QScrollBar::sub-line:horizontal { + width: 15px; + background: transparent; + image: url(:/White/arrowLeft); + subcontrol-position: left; +} +QScrollBar::add-line:horizontal { + width: 15px; + background: transparent; + image: url(:/White/arrowRight); + subcontrol-position: right; +} +QScrollBar::sub-line:horizontal:hover { + background: rgb(170, 200, 230); +} +QScrollBar::add-line:horizontal:hover { + background: rgb(170, 200, 230); +} +QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal { + background: transparent; +} + +/**********滚动条-垂直**********/ +QScrollBar:vertical { + width: 20px; + background: transparent; + margin-left: 3px; + margin-right: 3px; +} +QScrollBar::handle:vertical { + width: 20px; + min-height: 30px; + background: rgb(170, 200, 230); + margin-top: 15px; + margin-bottom: 15px; +} +QScrollBar::handle:vertical:hover { + background: rgb(165, 195, 225); +} +QScrollBar::sub-line:vertical { + height: 15px; + background: transparent; + image: url(:/White/topArrow); + subcontrol-position: top; +} +QScrollBar::add-line:vertical { + height: 15px; + background: transparent; + image: url(:/White/bottomArrow); + subcontrol-position: bottom; +} +QScrollBar::sub-line:vertical:hover { + background: rgb(170, 200, 230); +} +QScrollBar::add-line:vertical:hover { + background: rgb(170, 200, 230); +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: transparent; +} + +QScrollBar#verticalScrollBar:vertical { + margin-top: 30px; +} + +/**********下拉列表**********/ +QComboBox { + height: 25px; + border-radius: 4px; + border: 1px solid rgb(111, 156, 207); + background: white; +} +QComboBox:enabled { + color: rgb(84, 84, 84); +} +QComboBox:!enabled { + color: rgb(80, 80, 80); +} +QComboBox:enabled:hover, QComboBox:enabled:focus { + color: rgb(51, 51, 51); +} +QComboBox::drop-down { + width: 20px; + border: none; + background: transparent; +} +QComboBox::drop-down:hover { + background: rgba(255, 255, 255, 30); +} +QComboBox::down-arrow { + image: url(:/White/arrowBottom); +} +QComboBox::down-arrow:on { + /**top: 1px;**/ +} +QComboBox QAbstractItemView { + border: 1px solid rgb(111, 156, 207); + background: white; + outline: none; +} +QComboBox QAbstractItemView::item { + height: 25px; + color: rgb(73, 73, 73); +} +QComboBox QAbstractItemView::item:selected { + background: rgb(232, 241, 250); + color: rgb(2, 65, 132); +} + +/**********进度条**********/ +QProgressBar{ + border: none; + text-align: center; + color: white; + background: rgb(173, 202, 232); +} +QProgressBar::chunk { + background: rgb(16, 135, 209); +} + +QProgressBar#progressBar { + border: none; + text-align: center; + color: white; + background-color: transparent; + background-image: url(":/White/progressBar"); + background-repeat: repeat-x; +} +QProgressBar#progressBar::chunk { + border: none; + background-color: transparent; + background-image: url(":/White/progressBarChunk"); + background-repeat: repeat-x; +} + +/**********复选框**********/ +QCheckBox{ + spacing: 5px; +} +QCheckBox:enabled:checked{ + color: rgb(2, 65, 132); +} +QCheckBox:enabled:!checked{ + color: rgb(70, 71, 73); +} +QCheckBox:enabled:hover{ + color: rgb(0, 78, 161); +} +QCheckBox:!enabled{ + color: rgb(80, 80, 80); +} +QCheckBox::indicator { + width: 20px; + height: 20px; +} +QCheckBox::indicator:unchecked { + image: url(:/White/checkBox); +} +QCheckBox::indicator:unchecked:hover { + image: url(:/White/checkBoxHover); +} +QCheckBox::indicator:unchecked:pressed { + image: url(:/White/checkBoxPressed); +} +QCheckBox::indicator:checked { + image: url(:/White/checkBoxChecked); +} +QCheckBox::indicator:checked:hover { + image: url(:/White/checkBoxCheckedHover); +} +QCheckBox::indicator:checked:pressed { + image: url(:/White/checkBoxCheckedPressed); +} +QCheckBox::indicator:indeterminate { + image: url(:/White/checkBoxIndeterminate); +} +QCheckBox::indicator:indeterminate:hover { + image: url(:/White/checkBoxIndeterminateHover); +} +QCheckBox::indicator:indeterminate:pressed { + image: url(:/White/checkBoxIndeterminatePressed); +} + +/**********单选框**********/ +QRadioButton{ + spacing: 5px; +} +QRadioButton:enabled:checked{ + color: rgb(2, 65, 132); +} +QRadioButton:enabled:!checked{ + color: rgb(70, 71, 73); +} +QRadioButton:enabled:hover{ + color: rgb(0, 78, 161); +} +QRadioButton:!enabled{ + color: rgb(80, 80, 80); +} +QRadioButton::indicator { + width: 20px; + height: 20px; +} +QRadioButton::indicator:unchecked { + image: url(:/White/radioButton); +} +QRadioButton::indicator:unchecked:hover { + image: url(:/White/radioButtonHover); +} +QRadioButton::indicator:unchecked:pressed { + image: url(:/White/radioButtonPressed); +} +QRadioButton::indicator:checked { + image: url(:/White/radioButtonChecked); +} +QRadioButton::indicator:checked:hover { + image: url(:/White/radioButtonCheckedHover); +} +QRadioButton::indicator:checked:pressed { + image: url(:/White/radioButtonCheckedPressed); +} + +/**********输入框**********/ +QLineEdit { + border-radius: 4px; + height: 25px; + border: 1px solid rgb(111, 156, 207); + background: white; +} +QLineEdit:enabled { + color: rgb(84, 84, 84); +} +QLineEdit:enabled:hover, QLineEdit:enabled:focus { + color: rgb(51, 51, 51); +} +QLineEdit:!enabled { + color: rgb(80, 80, 80); +} + +/**********文本编辑框**********/ +QTextEdit { + border: 1px solid rgb(111, 156, 207); + color: rgb(70, 71, 73); + background: rgb(187, 212, 238); +} + + +QPlainTextEdit { + border: 1px solid rgb(111, 156, 207); + color: rgb(70, 71, 73); + background: rgb(255, 255, 255); +} + +/**********文本浏览框**********/ +QTextBrowser { + border: 1px solid rgb(111, 156, 207); + color: rgb(70, 71, 73); + background: rgb(255, 255, 255); +} + +/**********滚动区域**********/ +QScrollArea { + border: 1px solid rgb(111, 156, 207); + background: rgb(187, 212, 238); +} + +/**********滚动区域**********/ +QWidget#transparentWidget { + background: transparent; +} + +/**********微调器**********/ +QSpinBox { + border-radius: 4px; + height: 24px; + min-width: 40px; + border: 1px solid rgb(111, 156, 207); + background: white; +} +QSpinBox:enabled { + color: rgb(60, 60, 60); +} +QSpinBox:enabled:hover, QSpinBox:enabled:focus { + color: rgb(51, 51, 51); +} +QSpinBox:!enabled { + color: rgb(210, 210, 210); + background: transparent; +} +QSpinBox::up-button { + border-left: 1px solid rgb(111, 156, 207); + width: 18px; + height: 12px; + border-top-right-radius: 4px; + image: url(:/White/upButton); +} +QSpinBox::up-button:!enabled { + background: transparent; +} +QSpinBox::up-button:enabled:hover { + background: rgb(255, 255, 255, 30); +} +QSpinBox::down-button { + border-left: 1px solid rgb(111, 156, 207); + width: 18px; + height: 12px; + border-bottom-right-radius: 4px; + image: url(:/White/downButton); +} +QSpinBox::down-button:!enabled { + background: transparent; +} +QSpinBox::down-button:hover { + background: rgb(255, 255, 255, 30); +} + +/**********标签**********/ +QLabel#grayLabel { + color: rgb(70, 71, 73); +} + +QLabel#highlightLabel { + color: rgb(2, 65, 132); +} + +QLabel#redLabel { + color: red; +} + +QLabel#grayYaHeiLabel { + color: rgb(175, 175, 175); + font-size: 16px; +} + +QLabel#blueLabel { + color: rgb(0, 160, 230); +} + +QLabel#listLabel { + color: rgb(51, 51, 51); +} + +QLabel#lineBlueLabel { + background: rgb(0, 78, 161); +} + +QLabel#graySeperateLabel { + background: rgb(200, 220, 230); +} + +QLabel#seperateLabel { + background: rgb(112, 153, 194); +} + +QLabel#radiusBlueLabel { + border-radius: 15px; + color: white; + font-size: 16px; + background: rgb(0, 78, 161); +} + +QLabel#skinLabel[colorProperty="normal"] { + color: rgb(56, 99, 154); +} +QLabel#skinLabel[colorProperty="highlight"] { + color: rgb(0, 160, 230); +} + +QLabel#informationLabel { + qproperty-pixmap: url(:/White/information); +} + +QLabel#errorLabel { + qproperty-pixmap: url(:/White/error); +} + +QLabel#successLabel { + qproperty-pixmap: url(:/White/success); +} + +QLabel#questionLabel { + qproperty-pixmap: url(:/White/question); +} + +QLabel#warningLabel { + qproperty-pixmap: url(:/White/warning); +} + +QLabel#groupLabel { + color: rgb(56, 99, 154); + border: 1px solid rgb(111, 156, 207); + font-size: 15px; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; +} + +/**********按钮**********/ +QToolButton#nsccButton { + border: none; + color: rgb(2, 65, 132); + background: transparent; + padding: 10px; + qproperty-icon: url(:/White/nscc); + qproperty-iconSize: 32px 32px; + qproperty-toolButtonStyle: ToolButtonTextUnderIcon; +} +QToolButton#nsccButton:hover { + background: rgb(187, 212, 238); +} + +QToolButton#transferButton { + border: none; + color: rgb(2, 65, 132); + background: transparent; + padding: 10px; + qproperty-icon: url(:/White/transfer); + qproperty-iconSize: 32px 32px; + qproperty-toolButtonStyle: ToolButtonTextUnderIcon; +} +QToolButton#transferButton:hover { + background: rgb(187, 212, 238); +} + +/**********按钮**********/ +QPushButton{ + border-radius: 4px; + border: none; + width: 75px; + height: 25px; +} +QPushButton:enabled { + background: rgb(120, 170, 220); + color: white; +} +QPushButton:!enabled { + background: rgb(180, 180, 180); + color: white; +} +QPushButton:enabled:hover{ + background: rgb(100, 160, 220); +} +QPushButton:enabled:pressed{ + background: rgb(0, 78, 161); +} + +QPushButton#blueButton { + color: white; +} +QPushButton#blueButton:enabled { + background: rgb(0, 78, 161); + color: white; +} +QPushButton:!enabled { + background: rgb(180, 180, 180); + color: white; +} +QPushButton#blueButton:enabled:hover { + background: rgb(2, 65, 132); +} +QPushButton#blueButton:enabled:pressed { + background: rgb(6, 94, 187); +} + +QPushButton#selectButton { + border: none; + border-radius: none; + border-left: 1px solid rgb(111, 156, 207); + background: transparent; + image: url(:/White/scan); + color: rgb(51, 51, 51); +} +QPushButton#selectButton:enabled:hover{ + background: rgb(187, 212, 238); +} +QPushButton#selectButton:enabled:pressed{ + background: rgb(120, 170, 220); +} + +QPushButton#linkButton { + background: transparent; + color: rgb(0, 160, 230); + text-align:left; +} +QPushButton#linkButton:hover { + color: rgb(20, 185, 255); + text-decoration: underline; +} +QPushButton#linkButton:pressed { + color: rgb(0, 160, 230); +} + +QPushButton#transparentButton { + background: transparent; +} + +/*****************标题栏按钮*******************/ +QPushButton#minimizeButton { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(120, 170, 220); + image: url(:/White/minimizeHover); +} +QPushButton#minimizeButton:hover { + image: url(:/White/minimize); +} +QPushButton#minimizeButton:pressed { + image: url(:/White/minimizePressed); +} + +QPushButton#maximizeButton[maximizeProperty="maximize"] { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(120, 170, 220); + image: url(:/White/maximizeHover); +} +QPushButton#maximizeButton[maximizeProperty="maximize"]:hover { + image: url(:/White/maximize); +} +QPushButton#maximizeButton[maximizeProperty="maximize"]:pressed { + image: url(:/White/maximizePressed); +} + +QPushButton#maximizeButton[maximizeProperty="restore"] { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(120, 170, 220); + image: url(:/White/restoreHover); +} +QPushButton#maximizeButton[maximizeProperty="restore"]:hover { + image: url(:/White/restore); +} +QPushButton#maximizeButton[maximizeProperty="restore"]:pressed { + image: url(:/White/restorePressed); +} + +QPushButton#closeButton { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(120, 170, 220); + image: url(:/White/closeHover); +} +QPushButton#closeButton:hover { + image: url(:/White/close); +} +QPushButton#closeButton:pressed { + image: url(:/White/closePressed); +} + +QPushButton#skinButton { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(120, 170, 220); + image: url(:/White/skinHover); +} +QPushButton#skinButton:hover { + image: url(:/White/skin); +} +QPushButton#skinButton:pressed { + image: url(:/White/skinPressed); +} + +QPushButton#feedbackButton { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(120, 170, 220); + image: url(:/White/feedbackHover); +} +QPushButton#feedbackButton:hover { + image: url(:/White/feedback); +} +QPushButton#feedbackButton:pressed { + image: url(:/White/feedbackPressed); +} + +QPushButton#closeTipButton { + border-radius: none; + border-image: url(:/White/close); + background: transparent; +} +QPushButton#closeTipButton:hover { + border-image: url(:/White/closeHover); +} +QPushButton#closeTipButton:pressed { + border-image: url(:/White/closePressed); +} + +QPushButton#changeSkinButton{ + border-radius: 4px; + border: 2px solid rgb(111, 156, 207); + background: rgb(204, 227, 252); +} +QPushButton#changeSkinButton:hover{ + border-color: rgb(60, 150, 200); +} +QPushButton#changeSkinButton:pressed, QPushButton#changeSkinButton:checked{ + border-color: rgb(0, 160, 230); +} + +QPushButton#transferButton { + padding-left: 5px; + padding-right: 5px; + color: white; + background: rgb(0, 78, 161); +} +QPushButton#transferButton:hover { + background: rgb(2, 65, 132); +} +QPushButton#transferButton:pressed { + background: rgb(6, 94, 187); +} +QPushButton#transferButton[iconProperty="left"] { + qproperty-icon: url(:/White/left); +} +QPushButton#transferButton[iconProperty="right"] { + qproperty-icon: url(:/White/right); +} + +QPushButton#openButton { + border-radius: none; + image: url(:/White/open); + background: transparent; +} +QPushButton#openButton:hover { + image: url(:/White/openHover); +} +QPushButton#openButton:pressed { + image: url(:/White/openPressed); +} + +QPushButton#deleteButton { + border-radius: none; + image: url(:/White/delete); + background: transparent; +} +QPushButton#deleteButton:hover { + image: url(:/White/deleteHover); +} +QPushButton#deleteButton:pressed { + image: url(:/White/deletePressed); +} + +QPushButton#menuButton { + text-align: left center; + padding-left: 3px; + color: rgb(84, 84, 84); + border: 1px solid rgb(111, 156, 207); + background: white; +} +QPushButton#menuButton::menu-indicator{ + subcontrol-position: right center; + subcontrol-origin: padding; + image: url(:/White/arrowBottom); + padding-right: 3px; +} diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/2.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/2.qss new file mode 100644 index 0000000..61d4d11 --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/2.qss @@ -0,0 +1,996 @@ + + +*{ + font-size:13px; + color:white; + font-family:"宋体"; +} + +CallWidget QLineEdit#telEdt +{ + font-size:24px; + +} + +QMainWindow,QDialog{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #1B2534, stop: 0.4 #010101, + stop: 0.5 #000101, stop: 1.0 #1F2B3C); +} +QWidget{ + background:#121922; +} + +QLabel{ + background:transparent; +} + +QFrame{ + border-color:#32435E; + border-width:1px; + border-radius: 3px; +} + + +DailForm QLineEdit#phoneLineEdt{ + font-size:36px; + font-weight: bold; +} + +QPushButton,QToolButton{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #5B5F5F, stop: 0.5 #0C2436, + stop: 1.0 #27405A); + border-style: outset; + border-width: 1px; + border-radius: 5px; + border-color: #11223F; + padding: 1px; +} + +QPushButton::hover,QToolButton::hover{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #758385, stop: 0.5 #122C39, + stop: 1.0 #0E7788); + border-color: #11505C; +} + +QPushButton::pressed,QToolButton::pressed{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #969B9C, stop: 0.5 #16354B, + stop: 1.0 #244F76); + border-color: #11505C; +} +QPushButton::disabled,QToolButton::disabled{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #282B2C, stop: 0.5 #09121A, + stop: 1.0 #111D29); + border-color: #0A1320; + color:#6A6864; + +} + + + +QDialog QPushButton,QDialog QToolButton{ + min-width:30px; + min-height:23px; +} + +QToolButton[objectName="minimizeToolBtn"] { + background: transparent; + border:none; + image:url(qss/minimize.png) +} +QToolButton[objectName="minimizeToolBtn"]:hover,QToolButton[objectName="minimizeToolBtn"]:pressed { + image:url(qss/minimize_hover.png) +} +QToolButton[objectName="maximizeToolBtn"] { + background: transparent; + border:none; + image:url(qss/maximize.png) +} +QToolButton[objectName="maximizeToolBtn"]:hover,QToolButton[objectName="maximizeToolBtn"]:pressed { + image:url(qss/maximize_hover.png) +} + +QToolButton[objectName="closeToolBtn"],QToolButton[objectName="customCloseWindow"] { + background: transparent; + border:none; + image:url(qss/close.png) +} +QToolButton[objectName="closeToolBtn"]:hover,QToolButton[objectName="closeToolBtn"]:pressed{ + image:url(qss/close_hover.png) +} +QToolButton[objectName="customCloseWindow"]:hover,QToolButton[objectName="customCloseWindow"]:pressed{ + image:url(qss/close_hover.png) +} +QToolButton[objectName="titleSetUpToolBtn"]{ + background: transparent; + border:none; + image:url(qss/setup.png) +} + + +DailForm QToolButton#oneToolBtn,QToolButton#OneToolBtn,QToolButton#twoToolBtn,QToolButton#threeToolBtn, + QToolButton#fourToolBtn,QToolButton#fiveToolBtn,QToolButton#sixToolBtn, + QToolButton#sevenToolBtn,QToolButton#eightToolBtn,QToolButton#nineToolBtn, + QToolButton#starToolBtn,QToolButton#zeroToolBtn,QToolButton#sharpToolBtn { + font-size:36px; + border-radius: 10px; + +} +DailForm QToolButton#delToolBtn{ + border-radius: 10px; + +} + + + + + + +QLineEdit,QTextEdit { + border: 1px solid #32435E; + border-radius: 3px; + /* padding: 0 8px; */ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #080B10, + stop: 1.0 #212C3F); + selection-background-color: #0A246A; + +} +QLineEdit::hover{ + border-color:#5D8B9E; +} + +QLineEdit[echoMode="3"] { + lineedit-password-character: 9679; +} + +#QLineEdit:read-only { + background: #543F7C; +} + + +QTabWidget::pane { /* The tab widget frame */ + border: 0px solid #32435E; + position: absolute; + left: -0.1em; + + } + +QTabWidget#MainTabWidget::tab-bar { + left: -3px; /* move to the right by 5px */ + } + +QTabWidget#MainTabWidget QTabBar::tab { + height: 14ex; + width: 14ex; + + } + + + + QTabBar::tab { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #292F31, stop: 1 #0C131E); + } +QTabBar::tab:selected{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #113845, stop: 1.0 #15A8FF); + } +QTabBar::tab:hover { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #113845, stop: 1.0 #0E6F80); + } + + #QTabBar::tab:selected { + border-color: #32435E; + border-right-color: #32435E; /* same as pane color */ + } + + #QTabBar::tab:!selected { + margin-left: 2px; /* make non-selected tabs look smaller */ + } +#QTabBar:tab:first:selected { + margin-top: 0; +} +QTabBar:tab:last:selected { + margin-right: 0; +} +QTabBar:tab:only-one { + margin: 0; +} + +QListWidget{ + border: 1px solid #32435E; + background:#050609; +} + + +QListWidget::item:selected { + /*border: 0px solid #33CCFF;*/ + border:none; + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #6A848C, stop: 1.0 #0F9EAF); + padding:0px; + margin:0px; +} + +#QListWidget::item:selected:!active { + border-width: 0px ; + } +#QListWidget::item:selected:active { + border-width: 1px; + } + + + + +QComboBox { + border: 1px solid #32435E; + border-radius: 3px; + padding: 1px 18px 1px 3px; + min-width: 6em; + } +QComboBox::hover{ + border-color:#5D8B9E; +} + + + QComboBox:editable { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #080B10, + stop: 1.0 #212C3F); + } + + QComboBox:!editable, QComboBox::drop-down:editable { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #080B10, + stop: 1.0 #212C3F); + } + + /* QComboBox gets the "on" state when the popup is open */ + QComboBox:!editable:on, QComboBox::drop-down:editable:on { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #080B10, + stop: 1.0 #212C3F);; + } + + QComboBox:on { /* shift the text when the popup opens */ + padding-top: 3px; + padding-left: 4px; + } + QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 15px; + + border-left-width: 1px; + border-left-color: 32435E; + border-left-style: solid; /* just a single line */ + border-top-right-radius: 3px; /* same radius as the QComboBox */ + border-bottom-right-radius: 3px; + } + + QComboBox::down-arrow { + image: url(qss/downarrow.png); + } + + QComboBox::down-arrow:on { /* shift the arrow when popup is open */ + top: 1px; + left: 1px; + } + + QComboBox QAbstractItemView { + border: 2px solid #32435E; + selection-background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #506B79, + stop: 1.0 #0D95A6); + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #1B2534, stop: 0.4 #010101, + stop: 0.5 #000101, stop: 1.0 #1F2B3C); + } + + + + + +QCheckBox { + spacing: 5px; + } + + QCheckBox::indicator { + width: 13px; + height: 13px; + } + + QCheckBox::indicator:unchecked { + image: url(qss/checkbox_unchecked.png); + } + + QCheckBox::indicator:unchecked:hover { + image: url(qss/checkbox_unchecked_hover.png); + } + + QCheckBox::indicator:unchecked:pressed { + image: url(qss/checkbox_unchecked_pressed.png); + } + + QCheckBox::indicator:checked { + image: url(qss/checkbox_checked.png); + } + + QCheckBox::indicator:checked:hover { + image: url(qss/checkbox_checked_hover.png); + } + + QCheckBox::indicator:checked:pressed { + image: url(qss/checkbox_checked_pressed.png); + } + + QCheckBox::indicator:indeterminate:hover { + image: url(qss/checkbox_indeterminate_hover.png); + } + + QCheckBox::indicator:indeterminate:pressed { + image: url(qss/checkbox_indeterminate_pressed.png); + } + + + + + + QMenu { + background-color: #030406; + border-width:0px; + margin: 2px; + } + + QMenu::item { + background-color: #1D2838; + padding: 2px 25px 2px 20px; + border-color:transparent; + color:#858E94; + } + QMenu::item:!enabled { + background-color: #1D2838; + padding: 2px 25px 2px 20px; + border-color:transparent; + color:#76746C; + } + + QMenu::item:selected { + border-width:1px; + border-color: #516589; + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #1E293A, + stop: 1.0 #2C547E); + color:#E6FFFF; + } + + QMenu::icon:checked { /* appearance of a 'checked' icon */ + background: gray; + border: 1px inset gray; + position: absolute; + top: 1px; + right: 1px; + bottom: 1px; + left: 1px; + } + + QMenu::separator { + height: 1px; + background: #1D99A9; + /*margin-left: 10px;*/ + /*margin-right: 5px;*/ + } + + QMenu::indicator { + width: 13px; + height: 13px; + } + + /* non-exclusive indicator = check box style indicator (see QActionGroup::setExclusive) */ + QMenu::indicator:non-exclusive:unchecked { + image: url(qss/checkbox_unchecked.png); + } + + QMenu::indicator:non-exclusive:unchecked:selected { + image: url(qss/checkbox_unchecked_hover.png); + } + + QMenu::indicator:non-exclusive:checked { + image: url(qss/checkbox_checked.png); + } + + QMenu::indicator:non-exclusive:checked:selected { + image: url(qss/checkbox_checked_hover.png); + } + + /* exclusive indicator = radio button style indicator (see QActionGroup::setExclusive) */ + QMenu::indicator:exclusive:unchecked { + image: url(qss/radiobutton_unchecked.png); + } + + QMenu::indicator:exclusive:unchecked:selected { + image: url(qss/radiobutton_unchecked_hover.png); + } + + QMenu::indicator:exclusive:checked { + image: url(qss/radiobutton_checked.png); + } + + QMenu::indicator:exclusive:checked:selected { + image: url(qss/radiobutton_checked_hover.png); + } + + QMenuBar { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #121722, stop:1 #121722); + } + + QMenuBar::item { + spacing: 3px; /* spacing between menu bar items */ + padding: 1px 4px; + background: #10151E; + border-radius: 4px; + font:#BBDDFF; + } + + QMenuBar::item:selected { /* when selected using mouse or keyboard */ + background: #1A2432; + font:#FFFFFF; + } + + QMenuBar::item:pressed { + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #10151E, stop:1 #2C547E); + font:#FFFFFF; + + } + QMenuBar::item:hover{ + border-width:1px; + border-color:#516589; + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #9979A, stop:1 #2D567F); + font:#FFFFFF; + + } + +QListView{ + border: 1px solid #32435E; + background:#050609; +} + + + + QRadioButton::indicator { + width: 13px; + height: 13px; + } + + QRadioButton::indicator::unchecked { + image: url(qss/radiobutton_unchecked.png); + } + + QRadioButton::indicator:unchecked:hover { + image: url(qss/radiobutton_unchecked_hover.png); + } + + QRadioButton::indicator:unchecked:pressed { + image: url(qss/radiobutton_unchecked_pressed.png); + } + + QRadioButton::indicator::checked { + image: url(qss/radiobutton_checked.png); + } + + QRadioButton::indicator:checked:hover { + image: url(qss/radiobutton_checked_hover.png); + } + + QRadioButton::indicator:checked:pressed { + image: url(qss/radiobutton_checked_pressed.png); + } + + + QGroupBox { + border: 1px solid #2E3D57; + border-radius: 5px; + margin-top: 1ex; /* leave space at the top for the title */ + } + + QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top left; + padding: 0 3px; + background-color: transparent; + } + + QGroupBox::indicator { + width: 13px; + height: 13px; + } + + QGroupBox::indicator:unchecked { + image: url(qss/checkbox_unchecked.png); + } +QGroupBox::indicator:checked { + image: url(qss/checkbox_checked.png); +} + +QScrollBar:vertical { + border: 1px solid #32435E; + border-width: 0px 0px 0px 1px; + background: #21252F; + width: 12px; + margin: 12px 0 12px 0; + } + QScrollBar::handle:vertical { + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #60788C, stop:1 #1084BD); + min-height: 20px; + } + QScrollBar::add-line:vertical { + border: 1px solid #32435E; + border-width:0px 0px 0px 1px; + background:#21252F; + height: 12px; + subcontrol-position: bottom; + subcontrol-origin: margin; + } + + QScrollBar::sub-line:vertical { + border: 1px solid #32435E; + border-width:0px 0px 0px 1px; + background: #21252F; + height: 12px; + subcontrol-position: top; + subcontrol-origin: margin; + } + QScrollBar::up-arrow:vertical { + border: 1px solid transparent; + background: #21252F; + image: url(qss/up_arrow.png); + width: 7px; + height: 7px; + } + QScrollBar::up-arrow:vertical:hover,QScrollBar::up-arrow:vertical:pressed { + image: url(qss/up_arrow_hover.png); + } + + QScrollBar::down-arrow:vertical{ + border: 1px solid transparent; + background: #21252F; + image:url(qss/down_arrow.png); + width: 7px; + height: 7px; + } +QScrollBar::down-arrow:vertical:hover,QScrollBar::down-arrow:vertical:pressed{ + image: url(qss/down_arrow_hover.png); +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} + + + QScrollBar:horizontal { + border: 1px solid #32435E; + border-width: 1px 0px 0px 0px; + background: #21252F; + height: 12px; + margin: 0 12px 0 12px; + } + QScrollBar::handle:horizontal { + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #60788C, stop:1 #1084BD); + min-width: 20px; + } + QScrollBar::add-line:horizontal { + border: 1px solid #32435E; + border-width:1px 0px 0px 0px; + background:#21252F; + width: 12px; + subcontrol-position: right; + subcontrol-origin: margin; + } + + QScrollBar::sub-line:horizontal { + border: 1px solid #32435E; + border-width:1px 0px 0px 0px; + background: #21252F; + width: 12px; + subcontrol-position: left; + subcontrol-origin: margin; + } + QScrollBar::left-arrow:horizontal { + border: 1px solid transparent; + background: #21252F; + image: url(qss/left_arrow.png); + width: 7px; + height: 7px; + } + QScrollBar::left-arrow:horizontal:hover,QScrollBar::left-arrow:horizontal:pressed { + image: url(qss/left_arrow_hover.png); + } + + QScrollBar::right-arrow:horizontal{ + border: 1px solid transparent; + background: #21252F; + image:url(qss/right_arrow.png); + width: 7px; + height: 7px; + } +QScrollBar::right-arrow:horizontal:hover,QScrollBar::right-arrow:horizontal:pressed{ + image: url(qss/right_arrow_hover.png); +} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} + + + + + + + + +QSpinBox,QDateTimeEdit { + border: 1px solid #32435E; + border-radius: 3px; + padding-right: 5px; /* make room for the arrows */ + /* border-image: url(qss/frame.png) 4; */ + background:qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #080B10, stop:1 #212C3F); + } + QSpinBox::hover,QDateTimeEdit::hover{ + border-color:#5D8B9E; + } + + QSpinBox::up-button, QDateTimeEdit::up-button { + subcontrol-origin: border; + subcontrol-position: top right; /* position at the top right corner */ + + width: 16px; /* 16 + 2*1px border-width = 15px padding + 3px parent border */ + border-image: url(qss/spinup.png) 1; + border-width: 1px; + + + } + + QSpinBox::up-button:hover,QDateTimeEdit::up-button:hover { + border-image: url(qss/spinup_hover.png) 1; + } + + QSpinBox::up-button:pressed,QDateTimeEdit::up-button:pressed { + border-image: url(qss/spinup_pressed.png) 1; + } + + QSpinBox::up-arrow,QDateTimeEdit::up-arrow { + image: url(qss/up_arrow.png); + width: 7px; + height: 7px; + } + + QSpinBox::up-arrow:disabled, QSpinBox::up-arrow:off,QDateTimeEdit::up-arrow:disabled,QDateTimeEdit::up-arrow:off { /* off state when value is max */ + image: url(qss/up_arrow_disabled.png); + } + + QSpinBox::down-button,QDateTimeEdit::down-button { + subcontrol-origin: border; + subcontrol-position: bottom right; /* position at bottom right corner */ + + width: 16px; + border-image: url(qss/spindown.png) 1; + border-width: 1px; + border-top-width: 0; + } + + QSpinBox::down-button:hover,QDateTimeEdit::down-button:hover { + border-image: url(qss/spindown_hover.png) 1; + } + + QSpinBox::down-button:pressed,QDateTimeEdit::down-button:pressed { + border-image: url(qss/spindown_pressed.png) 1; + } + + QSpinBox::down-arrow,QDateTimeEdit::down-arrow { + image: url(qss/down_arrow.png); + width: 7px; + height: 7px; + } + + QSpinBox::down-arrow:disabled,QDateTimeEdit::down-arrow:disabled, + QSpinBox::down-arrow:off,QDateTimeEdit::down-arrow:off { /* off state when value in min */ + image: url(qss/down_arrow_disabled.png); + } + + + + + QToolTip { + border: 1.5px solid #179BAB; + padding: 3px; + border-radius: 8px; + opacity: 200; /*透明度*/ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #0C1016, + stop: 1.0 #233043); + } + + QStatusBar { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #07090E, + stop: 1.0 #202C3D); + } + + QStatusBar::item { + border: 1px solid #3E58A5; + border-radius: 3px; + } + +#QStatusBar QLabel { + border: 1px solid #6AF0FF; + /*background: white; */ +} + + +QSizeGrip { /*在MainWindow右下角*/ + image: url(qss/sizegrip.png); + width: 16px; + height: 16px; + } + + + + QHeaderView::section { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #353B43, stop:1 #151A20); + color: white; + padding-left: 4px; + border: 1px solid #447684; + } + + /* style the sort indicator */ + QHeaderView::down-arrow { + image: url(qss/down_arrow.png); + } + + QHeaderView::up-arrow { + image: url(qss/up_arrow.png); + } + QTableView { + selection-background-color: qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5, + stop: 0 #516A78, stop: 1 #10A9BA); + + gridline-color:#447684; + } + + + +QTreeWidget{ + background:#18202E; + border-style: outset; + border-width: 0px; + border-color: #11223F; + padding: 1px; +} + +QTreeWidget::branch:has-siblings:!adjoins-item { + border-image: url(qss/vline.png) 0; + } + + QTreeWidget::branch:has-siblings:adjoins-item { + border-image: url(qss/branch-more.png) 0; + } + + QTreeWidget::branch:!has-children:!has-siblings:adjoins-item { + border-image: url(qss/branch-end.png) 0; + } + + QTreeWidget::branch:has-children:!has-siblings:closed, + QTreeWidget::branch:closed:has-children:has-siblings { + border-image: none; + image: url(qss/branch-closed.png); + } + + QTreeWidget::branch:open:has-children:!has-siblings, + QTreeWidget::branch:open:has-children:has-siblings { + border-image: none; + image: url(qss/branch-open.png); + } + + + QTreeWidget::item { + border: 1px solid #d9d9d9; + border-color: transparent; + } + QTreeWidget::item:hover { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #598892, stop: 1 #189BAB); + border: 1px solid #bfcde4; + } + +QTreeWidget::item:selected { + /*border: 0px solid #33CCFF;*/ + border:none; + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #6A848C, stop: 1.0 #0F9EAF); + padding:0px; + margin:0px; +} + +QFrame#customTitleBar{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #454F53, stop: 1.0 #135263); +} + + +QWidget#TranslucentWidget * +{ + background-color: rgba( 255, 255, 255, 100 ); +} + +QWidget#TranslucentWidget QFrame#frame +{ + border-radius: 5px; +} + +QWidget#TranslucentWidget QPushButton { + + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #5B5F5F, stop: 0.5 #0C2436, + stop: 1.0 #27405A); + background-color: rgba( 255, 255, 255, 100 ); +} + +QWidget#TranslucentWidget QPushButton::hover{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #758385, stop: 0.5 #122C39, + stop: 1.0 #0E7788); + border-color: #11505C; +} + +QWidget#TranslucentWidget QPushButton::pressed{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #969B9C, stop: 0.5 #16354B, + stop: 1.0 #244F76); + border-color: #11505C; +} + + + +QWidget#GroupChatingWidget * +{ + background-color: rgba( 93, 93, 93, 30 ); + color:#FFFFFF; +} + +QWidget#GroupChatingWidget QLabel +{ + background: transparent; +} + +QWidget#GroupChatingWidget QFrame#mainFrame +{ + border-radius: 5px; +} + + + +QWidget#GroupChatingWidget QPushButton::hover,QWidget#GroupChatingWidget QToolButton::hover{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #758385, stop: 0.5 #122C39, + stop: 1.0 #0E7788); + border-color: #11505C; +} + +QWidget#GroupChatingWidget QPushButton::pressed,QWidget#GroupChatingWidget QToolButton::pressed{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #969B9C, stop: 0.5 #16354B, + stop: 1.0 #244F76); + border-color: #11505C; +} +QWidget#GroupChatingWidget QPushButton::disabled,QWidget#GroupChatingWidget QToolButton::disabled{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #282B2C, stop: 0.5 #09121A, + stop: 1.0 #111D29); + border-color: #0A1320; + color:#6A6864; + +} + + +QWidget#UserListWidget * +{ + background-color: rgba( 93, 93, 93, 30 ); + color:#FFFFFF; +} + +QWidget#GroupChatinSingleWidget * +{ + background-color: rgba( 93, 93, 93, 60 ); + color:#FFFFFF; +} +QWidget#GroupChatinSingleWidget QLabel +{ + background: transparent; +} +QWidget#GroupChatingWidget QPushButton::hover,QWidget#GroupChatingWidget QToolButton::hover{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #758385, stop: 0.5 #122C39, + stop: 1.0 #0E7788); + border-color: #11505C; +} + +QWidget#GroupChatingWidget QPushButton::pressed,QWidget#GroupChatingWidget QToolButton::pressed{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #969B9C, stop: 0.5 #16354B, + stop: 1.0 #244F76); + border-color: #11505C; +} +QWidget#GroupChatingWidget QPushButton::disabled,QWidget#GroupChatingWidget QToolButton::disabled{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #282B2C, stop: 0.5 #09121A, + stop: 1.0 #111D29); + border-color: #0A1320; + color:#6A6864; + +} + +QWidget#InfoAreaWidget * +{ + background-color: rgba( 93, 93, 93, 100 ); + color:#FFFFFF; + font: 75 12pt "宋体"; +} + +QWidget#InfoAreaWidget QLabel +{ + background: transparent; +} + +QWidget#GpsLeftBottomWidget * +{ + background-color: rgba( 93, 93, 93, 30 ); + color:#FFFFFF; +} + + +QWidget#GpsSysMenuWidget * +{ + background-color: rgba( 93, 93, 93, 30 ); + color:#FFFFFF; +} + +QWidget#GpsRigthBottomWidget * +{ + background-color: rgba( 93, 93, 93, 30 ); + color:#FFFFFF; +} + + + +QWidget#GpsRightTopWidget * +{ + background-color: rgba( 93, 93, 93, 30 ); + color:#FFFFFF; +} + +QWidget#VideoImageWidget QFrame#topFrame,QWidget#VideoImageWidget QFrame#bottomFrame{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #454F53, stop: 1.0 #135263); +} + + +QWidget#NavItemMenuWidget * +{ + background-color: rgba( 93, 93, 93, 30 ); + color:#FFFFFF; +} +QWidget#NavItemMenuWidget QLabel +{ + background: transparent; +} + diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/3.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/3.qss new file mode 100644 index 0000000..0e88dba --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/3.qss @@ -0,0 +1,587 @@ +/* +AMOLED Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 15/10/2019, 11:40. +Available at: https://github.com/GTRONICK/QSS/blob/master/AMOLED.qss +*/ +QMainWindow { + background-color:#000000; +} +QDialog { + background-color:#000000; +} +QColorDialog { + background-color:#000000; +} +QTextEdit { + background-color:#000000; + color: #a9b7c6; +} +QPlainTextEdit { + selection-background-color:#f39c12; + background-color:#000000; + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-width: 1px; + color: #a9b7c6; +} +QPushButton{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-width: 1px; + border-style: solid; + color: #a9b7c6; + padding: 2px; + background-color: #000000; +} +QPushButton::default{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-width: 1px; + color: #a9b7c6; + padding: 2px; + background-color: #000000; +} +QPushButton:hover{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-bottom-width: 1px; + border-bottom-radius: 6px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 2px; + background-color: #000000; +} +QPushButton:pressed{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-bottom-width: 2px; + border-bottom-radius: 6px; + border-style: solid; + color: #e67e22; + padding-bottom: 1px; + background-color: #000000; +} +QPushButton:disabled{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 2px; + border-bottom-radius: 6px; + border-style: solid; + color: #808086; + padding-bottom: 1px; + background-color: #000000; +} +QToolButton { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-bottom-width: 1px; + border-style: solid; + color: #a9b7c6; + padding: 2px; + background-color: #000000; +} +QToolButton:hover{ + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-bottom-width: 2px; + border-bottom-radius: 6px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 1px; + background-color: #000000; +} +QLineEdit { + border-width: 1px; border-radius: 4px; + border-color: rgb(58, 58, 58); + border-style: inset; + padding: 0 8px; + color: #a9b7c6; + background:#000000; + selection-background-color:#007b50; + selection-color: #FFFFFF; +} +QLabel { + color: #a9b7c6; +} +QLCDNumber { + color: #e67e22; +} +QProgressBar { + text-align: center; + color: rgb(240, 240, 240); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; + background-color:#000000; +} +QProgressBar::chunk { + background-color: #e67e22; + border-radius: 5px; +} +QMenu{ + background-color:#000000; +} +QMenuBar { + background:rgb(0, 0, 0); + color: #a9b7c6; +} +QMenuBar::item { + spacing: 3px; + padding: 1px 4px; + background: transparent; +} +QMenuBar::item:selected { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-bottom-width: 1px; + border-bottom-radius: 6px; + border-style: solid; + color: #FFFFFF; + padding-bottom: 0px; + background-color: #000000; +} +QMenu::item:selected { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: #e67e22; + border-bottom-color: transparent; + border-left-width: 2px; + color: #FFFFFF; + padding-left:15px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; + background-color:#000000; +} +QMenu::item { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + border-style: solid; + color: #a9b7c6; + padding-left:17px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; + background-color:#000000; +} +QTabWidget { + color:rgb(0,0,0); + background-color:#000000; +} +QTabWidget::pane { + border-color: rgb(77,77,77); + background-color:#000000; + border-style: solid; + border-width: 1px; + border-radius: 6px; +} +QTabBar::tab { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + border-style: solid; + color: #808086; + padding: 3px; + margin-left:3px; + background-color:#000000; +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: #e67e22; + border-bottom-width: 2px; + border-style: solid; + color: #FFFFFF; + padding-left: 3px; + padding-bottom: 2px; + margin-left:3px; + background-color:#000000; +} + +QCheckBox { + color: #a9b7c6; + padding: 2px; +} +QCheckBox:disabled { + color: #808086; + padding: 2px; +} + +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: rgb(87, 97, 106); + background-color:#000000; +} +QCheckBox::indicator:checked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #e67e22; + color: #a9b7c6; + background-color: #e67e22; +} +QCheckBox::indicator:unchecked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #e67e22; + color: #a9b7c6; + background-color: transparent; +} +QRadioButton { + color: #a9b7c6; + background-color:#000000; + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #e67e22; + color: #a9b7c6; + background-color: #e67e22; +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #e67e22; + color: #a9b7c6; + background-color: transparent; +} +QStatusBar { + color:#027f7f; +} +QSpinBox { + color: #a9b7c6; + background-color:#000000; +} +QDoubleSpinBox { + color: #a9b7c6; + background-color:#000000; +} +QTimeEdit { + color: #a9b7c6; + background-color:#000000; +} +QDateTimeEdit { + color: #a9b7c6; + background-color:#000000; +} +QDateEdit { + color: #a9b7c6; + background-color:#000000; +} +QComboBox { + color: #a9b7c6; + background: #1e1d23; +} +QComboBox:editable { + background: #1e1d23; + color: #a9b7c6; + selection-background-color:#000000; +} +QComboBox QAbstractItemView { + color: #a9b7c6; + background: #1e1d23; + selection-color: #FFFFFF; + selection-background-color:#000000; +} +QComboBox:!editable:on, QComboBox::drop-down:editable:on { + color: #a9b7c6; + background: #1e1d23; +} +QFontComboBox { + color: #a9b7c6; + background-color:#000000; +} +QToolBox { + color: #a9b7c6; + background-color:#000000; +} +QToolBox::tab { + color: #a9b7c6; + background-color:#000000; +} +QToolBox::tab:selected { + color: #FFFFFF; + background-color:#000000; +} +QScrollArea { + color: #FFFFFF; + background-color:#000000; +} +QSlider::groove:horizontal { + height: 5px; + background: #e67e22; +} +QSlider::groove:vertical { + width: 5px; + background: #e67e22; +} +QSlider::handle:horizontal { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f); + border: 1px solid #5c5c5c; + width: 14px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: qlineargradient(x1:1, y1:1, x2:0, y2:0, stop:0 #b4b4b4, stop:1 #8f8f8f); + border: 1px solid #5c5c5c; + height: 14px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal { + background: white; +} +QSlider::add-page:vertical { + background: white; +} +QSlider::sub-page:horizontal { + background: #e67e22; +} +QSlider::sub-page:vertical { + background: #e67e22; +} +QScrollBar:horizontal { + max-height: 20px; + background: rgb(0,0,0); + border: 1px transparent grey; + margin: 0px 20px 0px 20px; +} +QScrollBar::handle:horizontal { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + border-style: solid; + border-width: 1px; + border-color: rgb(0,0,0); + min-width: 25px; +} +QScrollBar::handle:horizontal:hover { + background: rgb(230, 126, 34); + border-style: solid; + border-width: 1px; + border-color: rgb(0,0,0); + min-width: 25px; +} +QScrollBar::add-line:horizontal { + border: 1px solid; + border-color: rgb(0,0,0); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:hover { + border: 1px solid; + border-color: rgb(0,0,0); + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:pressed { + border: 1px solid; + border-color: grey; + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal { + border: 1px solid; + border-color: rgb(0,0,0); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:hover { + border: 1px solid; + border-color: rgb(0,0,0); + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:pressed { + border: 1px solid; + border-color: grey; + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::left-arrow:horizontal { + border: 1px transparent grey; + border-radius: 3px; + width: 6px; + height: 6px; + background: rgb(0,0,0); +} +QScrollBar::right-arrow:horizontal { + border: 1px transparent grey; + border-radius: 3px; + width: 6px; + height: 6px; + background: rgb(0,0,0); +} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} +QScrollBar:vertical { + max-width: 20px; + background: rgb(0,0,0); + border: 1px transparent grey; + margin: 20px 0px 20px 0px; +} +QScrollBar::add-line:vertical { + border: 1px solid; + border-color: rgb(0,0,0); + background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:hover { + border: 1px solid; + border-color: rgb(0,0,0); + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:pressed { + border: 1px solid; + border-color: grey; + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical { + border: 1px solid; + border-color: rgb(0,0,0); + background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:hover { + border: 1px solid; + border-color: rgb(0,0,0); + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:pressed { + border: 1px solid; + border-color: grey; + border-radius: 8px; + background: rgb(230, 126, 34); + height: 16px; + width: 16px; + subcontrol-position: top; + subcontrol-origin: margin; +} + QScrollBar::handle:vertical { + background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 0), stop:0.7 rgba(255, 0, 0, 0), stop:0.71 rgb(230, 126, 34), stop:1 rgb(230, 126, 34)); + border-style: solid; + border-width: 1px; + border-color: rgb(0,0,0); + min-height: 25px; +} +QScrollBar::handle:vertical:hover { + background: rgb(230, 126, 34); + border-style: solid; + border-width: 1px; + border-color: rgb(0,0,0); + min-heigth: 25px; +} +QScrollBar::up-arrow:vertical { + border: 1px transparent grey; + border-radius: 3px; + width: 6px; + height: 6px; + background: rgb(0,0,0); +} +QScrollBar::down-arrow:vertical { + border: 1px transparent grey; + border-radius: 3px; + width: 6px; + height: 6px; + background: rgb(0,0,0); +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/4.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/4.qss new file mode 100644 index 0000000..cce4c77 --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/4.qss @@ -0,0 +1,559 @@ +/* +Aqua Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 22/01/2019, 07:55. +Available at: https://github.com/GTRONICK/QSS/blob/master/Aqua.qss +*/ +QMainWindow { + background-color:#ececec; +} +QTextEdit { + border-width: 1px; + border-style: solid; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QPlainTextEdit { + border-width: 1px; + border-style: solid; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QToolButton { + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QToolButton:hover{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(197, 197, 197), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(197, 197, 197)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QToolButton:pressed{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(142,142,142); +} +QPushButton{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QPushButton::default{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QPushButton:hover{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(197, 197, 197), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(197, 197, 197)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QPushButton:pressed{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(142,142,142); +} +QPushButton:disabled{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: #808086; + padding: 2px; + background-color: rgb(142,142,142); +} +QLineEdit { + border-width: 1px; border-radius: 4px; + border-style: solid; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QLabel { + color: #000000; +} +QLCDNumber { + color: rgb(0, 113, 255, 255); +} +QProgressBar { + text-align: center; + color: rgb(240, 240, 240); + border-width: 1px; + border-radius: 10px; + border-color: rgb(230, 230, 230); + border-style: solid; + background-color:rgb(207,207,207); +} +QProgressBar::chunk { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); + border-radius: 10px; +} +QMenuBar { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(207, 209, 207, 255), stop:1 rgba(230, 229, 230, 255)); +} +QMenuBar::item { + color: #000000; + spacing: 3px; + padding: 1px 4px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(207, 209, 207, 255), stop:1 rgba(230, 229, 230, 255)); +} + +QMenuBar::item:selected { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #FFFFFF; +} +QMenu::item:selected { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + border-bottom-color: transparent; + border-left-width: 2px; + color: #000000; + padding-left:15px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; +} +QMenu::item { + border-style: solid; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; + border-bottom-color: transparent; + border-bottom-width: 1px; + color: #000000; + padding-left:17px; + padding-top:4px; + padding-bottom:4px; + padding-right:7px; +} +QTabWidget { + color:rgb(0,0,0); + background-color:#000000; +} +QTabWidget::pane { + border-color: rgb(223,223,223); + background-color:rgb(226,226,226); + border-style: solid; + border-width: 2px; + border-radius: 6px; +} +QTabBar::tab:first { + border-style: solid; + border-left-width:1px; + border-right-width:0px; + border-top-width:1px; + border-bottom-width:1px; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + color: #000000; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(255, 255, 255, 255)); +} +QTabBar::tab:last { + border-style: solid; + border-width:1px; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-right-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + color: #000000; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(255, 255, 255, 255)); +} +QTabBar::tab { + border-style: solid; + border-top-width:1px; + border-bottom-width:1px; + border-left-width:1px; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + color: #000000; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(255, 255, 255, 255)); +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + border-style: solid; + border-left-width:1px; + border-right-color: transparent; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + color: #FFFFFF; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} + +QTabBar::tab:selected, QTabBar::tab:first:selected, QTabBar::tab:hover { + border-style: solid; + border-left-width:1px; + border-bottom-width:1px; + border-top-width:1px; + border-right-color: transparent; + border-top-color: rgb(209,209,209); + border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229)); + border-bottom-color: rgb(229,229,229); + color: #FFFFFF; + padding: 3px; + margin-left:0px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} + +QCheckBox { + color: #000000; + padding: 2px; +} +QCheckBox:disabled { + color: #808086; + padding: 2px; +} + +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: transparent; +} +QCheckBox::indicator:checked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #000000; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QCheckBox::indicator:unchecked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #000000; +} +QRadioButton { + color: 000000; + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #a9b7c6; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); + color: #a9b7c6; + background-color: transparent; +} +QStatusBar { + color:#027f7f; +} +QSpinBox { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QDoubleSpinBox { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QTimeEdit { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QDateTimeEdit { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} +QDateEdit { + border-style: solid; + border-width: 1px; + border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255)); +} + +QToolBox { + color: #a9b7c6; + background-color:#000000; +} +QToolBox::tab { + color: #a9b7c6; + background-color:#000000; +} +QToolBox::tab:selected { + color: #FFFFFF; + background-color:#000000; +} +QScrollArea { + color: #FFFFFF; + background-color:#000000; +} +QSlider::groove:horizontal { + height: 5px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); +} +QSlider::groove:vertical { + width: 5px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); +} +QSlider::handle:horizontal { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + width: 12px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + height: 12px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal { + background: rgb(181,181,181); +} +QSlider::add-page:vertical { + background: rgb(181,181,181); +} +QSlider::sub-page:horizontal { + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); +} +QSlider::sub-page:vertical { + background-color: qlineargradient(spread:pad, y1:0.5, x1:1, y2:0.5, x2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255)); +} +QScrollBar:horizontal { + max-height: 20px; + border: 1px transparent grey; + margin: 0px 20px 0px 20px; +} +QScrollBar:vertical { + max-width: 20px; + border: 1px transparent grey; + margin: 20px 0px 20px 0px; +} +QScrollBar::handle:horizontal { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + border-radius: 7px; + min-width: 25px; +} +QScrollBar::handle:horizontal:hover { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(147, 200, 200); + border-radius: 7px; + min-width: 25px; +} +QScrollBar::handle:vertical { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + border-radius: 7px; + min-height: 25px; +} +QScrollBar::handle:vertical:hover { + background: rgb(253,253,253); + border-style: solid; + border-width: 1px; + border-color: rgb(147, 200, 200); + border-radius: 7px; + min-height: 25px; +} +QScrollBar::add-line:horizontal { + border: 2px transparent grey; + border-top-right-radius: 7px; + border-bottom-right-radius: 7px; + background: rgba(34, 142, 255, 255); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:pressed { + border: 2px transparent grey; + border-top-right-radius: 7px; + border-bottom-right-radius: 7px; + background: rgb(181,181,181); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical { + border: 2px transparent grey; + border-bottom-left-radius: 7px; + border-bottom-right-radius: 7px; + background: rgba(34, 142, 255, 255); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:pressed { + border: 2px transparent grey; + border-bottom-left-radius: 7px; + border-bottom-right-radius: 7px; + background: rgb(181,181,181); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal { + border: 2px transparent grey; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgba(34, 142, 255, 255); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:pressed { + border: 2px transparent grey; + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + background: rgb(181,181,181); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical { + border: 2px transparent grey; + border-top-left-radius: 7px; + border-top-right-radius: 7px; + background: rgba(34, 142, 255, 255); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:pressed { + border: 2px transparent grey; + border-top-left-radius: 7px; + border-top-right-radius: 7px; + background: rgb(181,181,181); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::left-arrow:horizontal { + border: 1px transparent grey; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; + width: 6px; + height: 6px; + background: white; +} +QScrollBar::right-arrow:horizontal { + border: 1px transparent grey; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; + width: 6px; + height: 6px; + background: white; +} +QScrollBar::up-arrow:vertical { + border: 1px transparent grey; + border-top-left-radius: 3px; + border-top-right-radius: 3px; + width: 6px; + height: 6px; + background: white; +} +QScrollBar::down-arrow:vertical { + border: 1px transparent grey; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + width: 6px; + height: 6px; + background: white; +} +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/5.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/5.qss new file mode 100644 index 0000000..57ee5e1 --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/5.qss @@ -0,0 +1,954 @@ +/* +* The MIT License (MIT) +* +* Copyright : http://blog.csdn.net/liang19890820 +* +* Author : 一去丶二三里 +* +* Date : 2016/07/22 +* +* Description : 黑色炫酷 +* +*/ + +/**********子界面背景**********/ +QWidget#customWidget { + background: rgb(68, 69, 73); +} + +/**********子界面中央背景**********/ +QWidget#centerWidget { + background: rgb(50, 50, 50); +} + +/**********主界面样式**********/ +QWidget#mainWindow { + border: 1px solid rgb(50, 50, 50); + background: rgb(50, 50, 50); +} + +QWidget#messageWidget { + background: rgba(68, 69, 73, 50%); +} + +QWidget#loadingWidget { + border: none; + border-radius: 5px; + background: rgb(50, 50, 50); +} + +QWidget#remoteWidget { + border-top-right-radius: 10px; + border-bottom-right-radius: 10px; + border: 1px solid rgb(45, 45, 45); + background: rgb(50, 50, 50); +} + +StyledWidget { + qproperty-normalColor: white; + qproperty-disableColor: gray; + qproperty-highlightColor: rgb(0, 160, 230); + qproperty-errorColor: red; +} + +QProgressIndicator { + qproperty-color: rgb(175, 175, 175); +} + +/**********提示**********/ +QToolTip{ + border: 1px solid rgb(45, 45, 45); + background: white; + color: black; +} + +/**********菜单栏**********/ +QMenuBar { + background: rgb(57, 58, 60); + border: none; +} +QMenuBar::item { + padding: 5px 10px 5px 10px; + background: transparent; +} +QMenuBar::item:enabled { + color: rgb(227, 234, 242); +} +QMenuBar::item:!enabled { + color: rgb(155, 155, 155); +} +QMenuBar::item:enabled:selected { + background: rgba(255, 255, 255, 40); +} + +/**********菜单**********/ +QMenu { + border: 1px solid rgb(100, 100, 100); + background: rgb(68, 69, 73); +} +QMenu::item { + height: 22px; + padding: 0px 25px 0px 20px; +} +QMenu::item:enabled { + color: rgb(225, 225, 225); +} +QMenu::item:!enabled { + color: rgb(155, 155, 155); +} +QMenu::item:enabled:selected { + color: rgb(230, 230, 230); + background: rgba(255, 255, 255, 40); +} +QMenu::separator { + height: 1px; + background: rgb(100, 100, 100); +} +QMenu::indicator { + width: 13px; + height: 13px; +} +QMenu::icon { + padding-left: 2px; + padding-right: 2px; +} + +/**********状态栏**********/ +QStatusBar { + background: rgb(57, 58, 60); +} +QStatusBar::item { + border: none; + border-right: 1px solid rgb(100, 100, 100); +} + +/**********分组框**********/ +QGroupBox { + font-size: 15px; + border: 1px solid rgb(80, 80, 80); + border-radius: 4px; + margin-top: 10px; +} +QGroupBox::title { + color: rgb(175, 175, 175); + top: -12px; + left: 10px; +} + +/**********页签项**********/ +QTabWidget::pane { + border: none; + border-top: 3px solid rgb(0, 160, 230); + background: rgb(57, 58, 60); +} +QTabWidget::tab-bar { + border: none; +} +QTabBar::tab { + border: none; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + color: rgb(175, 175, 175); + background: rgb(255, 255, 255, 30); + height: 28px; + min-width: 85px; + margin-right: 5px; + padding-left: 5px; + padding-right: 5px; +} +QTabBar::tab:hover { + background: rgb(255, 255, 255, 40); +} +QTabBar::tab:selected { + color: white; + background: rgb(0, 160, 230); +} + +QTabWidget#tabWidget::pane { + border: 1px solid rgb(45, 45, 45); + background: rgb(57, 58, 60); + margin-top: -1px; +} + +QTabBar#tabBar::tab { + border: 1px solid rgb(45, 45, 45); + border-bottom: none; + background: transparent; +} +QTabBar#tabBar::tab:hover { + color: white; +} +QTabBar#tabBar::tab:selected { + color: white; + background: rgb(57, 58, 60); +} + +/**********表头**********/ +QHeaderView{ + border: none; + border-bottom: 3px solid rgb(0, 160, 230); + background: rgb(57, 58, 60); + min-height: 30px; +} +QHeaderView::section:horizontal { + border: none; + color: white; + background: transparent; + padding-left: 5px; +} +QHeaderView::section:horizontal:hover { + background: rgb(0, 160, 230); +} +QHeaderView::section:horizontal:pressed { + background: rgb(0, 180, 255); +} +QHeaderView::up-arrow { + width: 13px; + height: 11px; + padding-right: 5px; + image: url(:/Black/topArrow); + subcontrol-position: center right; +} +QHeaderView::up-arrow:hover, QHeaderView::up-arrow:pressed { + image: url(:/Black/topArrowHover); +} +QHeaderView::down-arrow { + width: 13px; + height: 11px; + padding-right: 5px; + image: url(:/Black/bottomArrow); + subcontrol-position: center right; +} +QHeaderView::down-arrow:hover, QHeaderView::down-arrow:pressed { + image: url(:/Black/bottomArrowHover); +} + +/**********表格**********/ +QTableView { + border: 1px solid rgb(45, 45, 45); + background: rgb(57, 58, 60); + gridline-color: rgb(60, 60, 60); +} +QTableView::item { + padding-left: 5px; + padding-right: 5px; + border: none; + background: rgb(72, 72, 74); + border-right: 1px solid rgb(45, 45, 45); + border-bottom: 1px solid rgb(45, 45, 45); +} +QTableView::item:selected { + background: rgba(255, 255, 255, 40); +} +QTableView::item:selected:!active { + color: white; +} +QTableView::indicator { + width: 20px; + height: 20px; +} +QTableView::indicator:enabled:unchecked { + image: url(:/Black/checkBox); +} +QTableView::indicator:enabled:unchecked:hover { + image: url(:/Black/checkBoxHover); +} +QTableView::indicator:enabled:unchecked:pressed { + image: url(:/Black/checkBoxPressed); +} +QTableView::indicator:enabled:checked { + image: url(:/Black/checkBoxChecked); +} +QTableView::indicator:enabled:checked:hover { + image: url(:/Black/checkBoxCheckedHover); +} +QTableView::indicator:enabled:checked:pressed { + image: url(:/Black/checkBoxCheckedPressed); +} +QTableView::indicator:enabled:indeterminate { + image: url(:/Black/checkBoxIndeterminate); +} +QTableView::indicator:enabled:indeterminate:hover { + image: url(:/Black/checkBoxIndeterminateHover); +} +QTableView::indicator:enabled:indeterminate:pressed { + image: url(:/Black/checkBoxIndeterminatePressed); +} + +/**********滚动条-水平**********/ +QScrollBar:horizontal { + height: 20px; + background: transparent; + margin-top: 3px; + margin-bottom: 3px; +} +QScrollBar::handle:horizontal { + height: 20px; + min-width: 30px; + background: rgb(68, 69, 73); + margin-left: 15px; + margin-right: 15px; +} +QScrollBar::handle:horizontal:hover { + background: rgb(80, 80, 80); +} +QScrollBar::sub-line:horizontal { + width: 15px; + background: transparent; + image: url(:/Black/arrowLeft); + subcontrol-position: left; +} +QScrollBar::add-line:horizontal { + width: 15px; + background: transparent; + image: url(:/Black/arrowRight); + subcontrol-position: right; +} +QScrollBar::sub-line:horizontal:hover { + background: rgb(68, 69, 73); +} +QScrollBar::add-line:horizontal:hover { + background: rgb(68, 69, 73); +} +QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal { + background: transparent; +} + +/**********滚动条-垂直**********/ +QScrollBar:vertical { + width: 20px; + background: transparent; + margin-left: 3px; + margin-right: 3px; +} +QScrollBar::handle:vertical { + width: 20px; + min-height: 30px; + background: rgb(68, 69, 73); + margin-top: 15px; + margin-bottom: 15px; +} +QScrollBar::handle:vertical:hover { + background: rgb(80, 80, 80); +} +QScrollBar::sub-line:vertical { + height: 15px; + background: transparent; + image: url(:/Black/arrowTop); + subcontrol-position: top; +} +QScrollBar::add-line:vertical { + height: 15px; + background: transparent; + image: url(:/Black/arrowBottom); + subcontrol-position: bottom; +} +QScrollBar::sub-line:vertical:hover { + background: rgb(68, 69, 73); +} +QScrollBar::add-line:vertical:hover { + background: rgb(68, 69, 73); +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: transparent; +} + +QScrollBar#verticalScrollBar:vertical { + margin-top: 30px; +} + +/**********下拉列表**********/ +QComboBox { + height: 25px; + border-radius: 4px; + border: 1px solid rgb(100, 100, 100); + background: rgb(72, 72, 73); +} +QComboBox:enabled { + color: rgb(175, 175, 175); +} +QComboBox:!enabled { + color: rgb(155, 155, 155); +} +QComboBox:enabled:hover, QComboBox:enabled:focus { + color: rgb(230, 230, 230); + background: rgb(68, 69, 73); +} +QComboBox::drop-down { + width: 20px; + border: none; + background: transparent; +} +QComboBox::drop-down:hover { + background: rgba(255, 255, 255, 30); +} +QComboBox::down-arrow { + image: url(:/Black/arrowBottom); +} +QComboBox::down-arrow:on { + /**top: 1px;**/ +} +QComboBox QAbstractItemView { + border: 1px solid rgb(100, 100, 100); + background: rgb(68, 69, 73); + outline: none; +} +QComboBox QAbstractItemView::item { + height: 25px; + color: rgb(175, 175, 175); +} +QComboBox QAbstractItemView::item:selected { + background: rgba(255, 255, 255, 40); + color: rgb(230, 230, 230); +} + +/**********进度条**********/ +QProgressBar{ + border: none; + text-align: center; + color: white; + background: rgb(48, 50, 51); +} +QProgressBar::chunk { + background: rgb(0, 160, 230); +} + +QProgressBar#progressBar { + border: none; + text-align: center; + color: white; + background-color: transparent; + background-image: url(":/Black/progressBar"); + background-repeat: repeat-x; +} +QProgressBar#progressBar::chunk { + border: none; + background-color: transparent; + background-image: url(":/Black/progressBarChunk"); + background-repeat: repeat-x; +} + +/**********复选框**********/ +QCheckBox{ + spacing: 5px; +} +QCheckBox:enabled{ + color: rgb(175, 175, 175); +} +QCheckBox:enabled:hover{ + color: rgb(200, 200, 200); +} +QCheckBox:!enabled{ + color: rgb(155, 155, 155); +} +QCheckBox::indicator { + width: 20px; + height: 20px; +} +QCheckBox::indicator:unchecked { + image: url(:/Black/checkBox); +} +QCheckBox::indicator:unchecked:hover { + image: url(:/Black/checkBoxHover); +} +QCheckBox::indicator:unchecked:pressed { + image: url(:/Black/checkBoxPressed); +} +QCheckBox::indicator:checked { + image: url(:/Black/checkBoxChecked); +} +QCheckBox::indicator:checked:hover { + image: url(:/Black/checkBoxCheckedHover); +} +QCheckBox::indicator:checked:pressed { + image: url(:/Black/checkBoxCheckedPressed); +} +QCheckBox::indicator:indeterminate { + image: url(:/Black/checkBoxIndeterminate); +} +QCheckBox::indicator:indeterminate:hover { + image: url(:/Black/checkBoxIndeterminateHover); +} +QCheckBox::indicator:indeterminate:pressed { + image: url(:/Black/checkBoxIndeterminatePressed); +} + +/**********单选框**********/ +QRadioButton{ + spacing: 5px; +} +QRadioButton:enabled{ + color: rgb(175, 175, 175); +} +QRadioButton:enabled:hover{ + color: rgb(200, 200, 200); +} +QRadioButton:!enabled{ + color: rgb(155, 155, 155); +} +QRadioButton::indicator { + width: 20px; + height: 20px; +} +QRadioButton::indicator:unchecked { + image: url(:/Black/radioButton); +} +QRadioButton::indicator:unchecked:hover { + image: url(:/Black/radioButtonHover); +} +QRadioButton::indicator:unchecked:pressed { + image: url(:/Black/radioButtonPressed); +} +QRadioButton::indicator:checked { + image: url(:/Black/radioButtonChecked); +} +QRadioButton::indicator:checked:hover { + image: url(:/Black/radioButtonCheckedHover); +} +QRadioButton::indicator:checked:pressed { + image: url(:/Black/radioButtonCheckedPressed); +} + +/**********输入框**********/ +QLineEdit { + border-radius: 4px; + height: 25px; + border: 1px solid rgb(100, 100, 100); + background: rgb(72, 72, 73); +} +QLineEdit:enabled { + color: rgb(175, 175, 175); +} +QLineEdit:enabled:hover, QLineEdit:enabled:focus { + color: rgb(230, 230, 230); +} +QLineEdit:!enabled { + color: rgb(155, 155, 155); +} + +/**********文本编辑框**********/ +QTextEdit { + border: 1px solid rgb(45, 45, 45); + color: rgb(175, 175, 175); + background: rgb(57, 58, 60); +} + +/**********滚动区域**********/ +QScrollArea { + border: 1px solid rgb(45, 45, 45); + background: rgb(57, 58, 60); +} + +/**********滚动区域**********/ +QWidget#transparentWidget { + background: transparent; +} + +/**********微调器**********/ +QSpinBox { + border-radius: 4px; + height: 24px; + min-width: 40px; + border: 1px solid rgb(100, 100, 100); + background: rgb(68, 69, 73); +} +QSpinBox:enabled { + color: rgb(220, 220, 220); +} +QSpinBox:enabled:hover, QLineEdit:enabled:focus { + color: rgb(230, 230, 230); +} +QSpinBox:!enabled { + color: rgb(65, 65, 65); + background: transparent; +} +QSpinBox::up-button { + width: 18px; + height: 12px; + border-top-right-radius: 4px; + border-left: 1px solid rgb(100, 100, 100); + image: url(:/Black/upButton); + background: rgb(50, 50, 50); +} +QSpinBox::up-button:!enabled { + border-left: 1px solid gray; + background: transparent; +} +QSpinBox::up-button:enabled:hover { + background: rgb(255, 255, 255, 30); +} +QSpinBox::down-button { + width: 18px; + height: 12px; + border-bottom-right-radius: 4px; + border-left: 1px solid rgb(100, 100, 100); + image: url(:/Black/downButton); + background: rgb(50, 50, 50); +} +QSpinBox::down-button:!enabled { + border-left: 1px solid gray; + background: transparent; +} +QSpinBox::down-button:enabled:hover { + background: rgb(255, 255, 255, 30); +} + +/**********标签**********/ +QLabel#grayLabel { + color: rgb(175, 175, 175); +} + +QLabel#highlightLabel { + color: rgb(175, 175, 175); +} + +QLabel#redLabel { + color: red; +} + +QLabel#grayYaHeiLabel { + color: rgb(175, 175, 175); + font-size: 16px; +} + +QLabel#blueLabel { + color: rgb(0, 160, 230); +} + +QLabel#listLabel { + color: rgb(0, 160, 230); +} + +QLabel#lineBlueLabel { + background: rgb(0, 160, 230); +} + +QLabel#graySeperateLabel { + background: rgb(45, 45, 45); +} + +QLabel#seperateLabel { + background: rgb(80, 80, 80); +} + +QLabel#radiusBlueLabel { + border-radius: 15px; + color: white; + font-size: 16px; + background: rgb(0, 160, 230); +} + +QLabel#skinLabel[colorProperty="normal"] { + color: rgb(175, 175, 175); +} +QLabel#skinLabel[colorProperty="highlight"] { + color: rgb(0, 160, 230); +} + +QLabel#informationLabel { + qproperty-pixmap: url(:/Black/information); +} + +QLabel#errorLabel { + qproperty-pixmap: url(:/Black/error); +} + +QLabel#successLabel { + qproperty-pixmap: url(:/Black/success); +} + +QLabel#questionLabel { + qproperty-pixmap: url(:/Black/question); +} + +QLabel#warningLabel { + qproperty-pixmap: url(:/Black/warning); +} + +QLabel#groupLabel { + color: rgb(0, 160, 230); + border: 1px solid rgb(0, 160, 230); + font-size: 15px; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; +} + +/**********按钮**********/ +QToolButton#nsccButton{ + border: none; + color: rgb(175, 175, 175); + background: transparent; + padding: 10px; + qproperty-icon: url(:/Black/nscc); + qproperty-iconSize: 32px 32px; + qproperty-toolButtonStyle: ToolButtonTextUnderIcon; +} +QToolButton#nsccButton:hover{ + color: rgb(217, 218, 218); + background: rgb(255, 255, 255, 20); +} + +QToolButton#transferButton{ + border: none; + color: rgb(175, 175, 175); + background: transparent; + padding: 10px; + qproperty-icon: url(:/Black/transfer); + qproperty-iconSize: 32px 32px; + qproperty-toolButtonStyle: ToolButtonTextUnderIcon; +} +QToolButton#transferButton:hover{ + color: rgb(217, 218, 218); + background: rgb(255, 255, 255, 20); +} + +/**********按钮**********/ +QPushButton{ + border-radius: 4px; + border: none; + width: 75px; + height: 25px; +} +QPushButton:enabled { + background: rgb(68, 69, 73); + color: white; +} +QPushButton:!enabled { + background: rgb(100, 100, 100); + color: rgb(200, 200, 200); +} +QPushButton:enabled:hover{ + background: rgb(85, 85, 85); +} +QPushButton:enabled:pressed{ + background: rgb(80, 80, 80); +} + +QPushButton#blueButton { + color: white; +} +QPushButton#blueButton:enabled { + background: rgb(0, 165, 235); + color: white; +} +QPushButton#blueButton:!enabled { + background: gray; + color: rgb(200, 200, 200); +} +QPushButton#blueButton:enabled:hover { + background: rgb(0, 180, 255); +} +QPushButton#blueButton:enabled:pressed { + background: rgb(0, 140, 215); +} + +QPushButton#selectButton { + border: none; + border-radius: none; + border-left: 1px solid rgb(100, 100, 100); + image: url(:/Black/scan); + background: transparent; + color: white; +} +QPushButton#selectButton:enabled:hover{ + background: rgb(85, 85, 85); +} +QPushButton#selectButton:enabled:pressed{ + background: rgb(80, 80, 80); +} + +QPushButton#linkButton { + background: transparent; + color: rgb(0, 160, 230); + text-align:left; +} +QPushButton#linkButton:hover { + color: rgb(20, 185, 255); + text-decoration: underline; +} +QPushButton#linkButton:pressed { + color: rgb(0, 160, 230); +} + +QPushButton#transparentButton { + background: transparent; +} + +/*****************标题栏按钮*******************/ +QPushButton#minimizeButton { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(50, 50, 50); + image: url(:/Black/minimize); +} +QPushButton#minimizeButton:hover { + background: rgb(60, 60, 60); + image: url(:/Black/minimizeHover); +} +QPushButton#minimizeButton:pressed { + background: rgb(55, 55, 55); + image: url(:/Black/minimizePressed); +} + +QPushButton#maximizeButton[maximizeProperty="maximize"] { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(50, 50, 50); + image: url(:/Black/maximize); +} +QPushButton#maximizeButton[maximizeProperty="maximize"]:hover { + background: rgb(60, 60, 60); + image: url(:/Black/maximizeHover); +} +QPushButton#maximizeButton[maximizeProperty="maximize"]:pressed { + background: rgb(55, 55, 55); + image: url(:/Black/maximizePressed); +} + +QPushButton#maximizeButton[maximizeProperty="restore"] { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(50, 50, 50); + image: url(:/Black/restore); +} +QPushButton#maximizeButton[maximizeProperty="restore"]:hover { + background: rgb(60, 60, 60); + image: url(:/Black/restoreHover); +} +QPushButton#maximizeButton[maximizeProperty="restore"]:pressed { + background: rgb(55, 55, 55); + image: url(:/Black/restorePressed); +} + +QPushButton#closeButton { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(50, 50, 50); + image: url(:/Black/close); +} +QPushButton#closeButton:hover { + background: rgb(60, 60, 60); + image: url(:/Black/closeHover); +} +QPushButton#closeButton:pressed { + background: rgb(55, 55, 55); + image: url(:/Black/closePressed); +} + +QPushButton#skinButton { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(50, 50, 50); + image: url(:/Black/skin); +} +QPushButton#skinButton:hover { + background: rgb(60, 60, 60); + image: url(:/Black/skinHover); +} +QPushButton#skinButton:pressed { + background: rgb(55, 55, 55); + image: url(:/Black/skinPressed); +} + +QPushButton#feedbackButton { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(50, 50, 50); + image: url(:/Black/feedback); +} +QPushButton#feedbackButton:hover { + background: rgb(60, 60, 60); + image: url(:/Black/feedbackHover); +} +QPushButton#feedbackButton:pressed { + background: rgb(55, 55, 55); + image: url(:/Black/feedbackPressed); +} + +QPushButton#closeTipButton { + border-radius: none; + border-image: url(:/Black/close); + background: transparent; +} +QPushButton#closeTipButton:hover { + border-image: url(:/Black/closeHover); +} +QPushButton#closeTipButton:pressed { + border-image: url(:/Black/closePressed); +} + +QPushButton#changeSkinButton{ + border-radius: 4px; + border: 2px solid rgb(41, 41, 41); + background: rgb(51, 51, 51); +} +QPushButton#changeSkinButton:hover{ + border-color: rgb(45, 45, 45); +} +QPushButton#changeSkinButton:pressed, QPushButton#changeSkinButton:checked{ + border-color: rgb(0, 160, 230); +} + +QPushButton#transferButton { + padding-left: 5px; + padding-right: 5px; + color: white; + background: rgb(0, 165, 235); +} +QPushButton#transferButton:hover { + background: rgb(0, 180, 255); +} +QPushButton#transferButton:pressed { + background: rgb(0, 140, 215); +} +QPushButton#transferButton[iconProperty="left"] { + qproperty-icon: url(:/Black/left); +} +QPushButton#transferButton[iconProperty="right"] { + qproperty-icon: url(:/Black/right); +} + +QPushButton#openButton { + border-radius: none; + image: url(:/Black/open); + background: transparent; +} +QPushButton#openButton:hover { + image: url(:/Black/openHover); +} +QPushButton#openButton:pressed { + image: url(:/Black/openPressed); +} + +QPushButton#deleteButton { + border-radius: none; + image: url(:/Black/delete); + background: transparent; +} +QPushButton#deleteButton:hover { + image: url(:/Black/deleteHover); +} +QPushButton#deleteButton:pressed { + image: url(:/Black/deletePressed); +} + +QPushButton#menuButton { + text-align: left center; + padding-left: 3px; + color: rgb(175, 175, 175); + border: 1px solid rgb(100, 100, 100); + background: rgb(72, 72, 73); +} +QPushButton#menuButton::menu-indicator{ + subcontrol-position: right center; + subcontrol-origin: padding; + image: url(:/Black/arrowBottom); + padding-right: 3px; +} diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/6.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/6.qss new file mode 100644 index 0000000..af6c204 --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/6.qss @@ -0,0 +1,181 @@ +/* +Dark Console Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 24/05/2018, 17:12. +Available at: https://github.com/GTRONICK/QSS/blob/master/ConsoleStyle.qss +*/ +QWidget { + background-color:rgb(0, 0, 0); + color: rgb(240, 240, 240); + border-color: rgb(58, 58, 58); +} + +QPlainTextEdit { + background-color:rgb(0, 0, 0); + color: rgb(200, 200, 200); + selection-background-color: rgb(255, 153, 0); + selection-color: rgb(0, 0, 0); +} + +QTabWidget::pane { + border-top: 1px solid #000000; +} + +QTabBar::tab { + background-color:rgb(0, 0, 0); + border-style: outset; + border-width: 1px; + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-top-width: 0px; + border-style: solid; + color: rgb(255, 153, 0); + padding: 4px; +} + +QTabBar::tab:selected, QTabBar::tab:hover { + color: rgb(255, 255, 255); + background-color:rgb(0, 0, 0); + border-color:rgb(42, 42, 42); + margin-left: 0px; + margin-right: 0px; + border-bottom-right-radius:4px; + border-bottom-left-radius:4px; +} + +QTabBar::tab:last:selected { + background-color:rgb(0, 0, 0); + border-color:rgb(42, 42, 42); + margin-left: 0px; + margin-right: 0px; + border-bottom-right-radius:4px; + border-bottom-left-radius:4px; +} + +QTabBar::tab:!selected { + margin-bottom: 4px; + border-bottom-right-radius:4px; + border-bottom-left-radius:4px; +} + +QPushButton{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); +} + +QPushButton:hover{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-bottom-color: rgb(115, 115, 115); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(107, 107, 107, 255), stop:1 rgba(157, 157, 157, 255)); +} + +QPushButton:pressed{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(62, 62, 62, 255), stop:1 rgba(22, 22, 22, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); +} + +QPushButton:disabled{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(0, 0, 0); + padding: 6px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(57, 57, 57, 255), stop:1 rgba(77, 77, 77, 255)); +} + +QLineEdit { + border-width: 1px; border-radius: 4px; + border-color: rgb(58, 58, 58); + border-style: inset; + padding: 0 8px; + color: rgb(255, 255, 255); + background:rgb(101, 101, 101); + selection-background-color: rgb(187, 187, 187); + selection-color: rgb(60, 63, 65); +} + +QProgressBar { + text-align: center; + color: rgb(255, 255, 255); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; +} + +QProgressBar::chunk { + background-color: qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(0, 200, 0, 255), stop:1 rgba(30, 230, 30, 255)); + border-radius: 10px; +} + +QMenuBar { + background:rgb(0, 0, 0); + color: rgb(255, 153, 0); +} + +QMenuBar::item { + spacing: 3px; + padding: 1px 4px; + background: transparent; +} + +QMenuBar::item:selected { + background:rgb(115, 115, 115); +} + +QMenu { + border-width: 2px; + border-radius: 10px; + border-color: rgb(255, 153, 0); + border-style: outset; +} + +QMenu::item { + spacing: 3px; + padding: 3px 15px; +} + +QMenu::item:selected { + spacing: 3px; + padding: 3px 15px; + background:rgb(115, 115, 115); + color:rgb(255, 255, 255); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; +} diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/7.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/7.qss new file mode 100644 index 0000000..5c365b6 --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/7.qss @@ -0,0 +1,93 @@ +/* ɫ +.QWidget { + background-color: rgb(50,50,50); +}*/ +QMainWindow::separator { + background: rgb(112,112,112); + width: 5px; /* when vertical */ + height: 5px; /* when horizontal */ +} + +QMenuBar { + color: rgb(192,192,192); + background-color: rgb(50,50,50); +} +QMenuBar::item { + spacing: 3px; /* spacing between menu bar items */ + padding: 1px 4px; + background: transparent; + border-radius: 4px; +} +QMenuBar::item:selected { /* when selected using mouse or keyboard */ + background: #a8a8a8; +} +QMenuBar::item:pressed { + background: #888888; +} + +/* ʾʽ */ +QToolTip { + border: 2px solid darkkhaki; + padding: 1px; + border-radius: 3px; +} + +.QToolBar { + background: qlineargradient(spread:reflect, x1:0.5, y1:0.5, x2:0.5, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(170, 170, 170, 255));\nbackground-color: qlineargradient(spread:reflect, x1:0.5, y1:0.5, x2:0.5, y2:0, stop:0.20339 rgba(51, 51, 51, 255), stop:1 rgba(206, 206, 206, 255)); + spacing: 3px; /* spacing between items in the tool bar */ + } + +/* Bold text on status bar looks awful. */ +QStatusBar{ + background-color: rgb(112,112,112); +} +QStatusBar::item { + border: 1px solid red; + border-radius: 3px; +} + +QDockWidget { + border: 5px solid black; +} +QDockWidget::title { + text-align: left; /* align the text to the left */ + background: darkgray; + padding-left: 10px; +} +QDockWidget::close-button, QDockWidget::float-button { + border: 1px solid transparent; + background: darkgray; + padding: 0px; +} + +QDockWidget::close-button:hover, QDockWidget::float-button:hover { + background: gray; +} + +QDockWidget::close-button:pressed, QDockWidget::float-button:pressed { + padding: 1px -1px -1px 1px; +} + +QTreeView { + background: rgb(50,50,50); + show-decoration-selected: 1; + } +QTreeView::item { + color: rgb(232,232,232); + border: 1px solid #d9d9d9; + border-top-color: transparent; + border-bottom-color: transparent; +} +QTreeView::item:hover { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1); + border: 1px solid #bfcde4; +} +QTreeView::item:selected { + border: 1px solid #567dbc; +} +QTreeView::item:selected:active{ + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6ea1f1, stop: 1 #567dbc); +} +QTreeView::item:selected:!active { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6b9be8, stop: 1 #577fbf); +} \ No newline at end of file diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/8.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/8.qss new file mode 100644 index 0000000..49d2b0b --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/8.qss @@ -0,0 +1,196 @@ +/* +ElegantDark Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 17/04/2018 +Available at: https://github.com/GTRONICK/QSS/blob/master/ElegantDark.qss +*/ +QMainWindow { + background-color:rgb(82, 82, 82); +} +QTextEdit { + background-color:rgb(42, 42, 42); + color: rgb(0, 255, 0); +} +QPushButton{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); +} +QPushButton:hover{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); + border-bottom-color: rgb(115, 115, 115); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(107, 107, 107, 255), stop:1 rgba(157, 157, 157, 255)); +} +QPushButton:pressed{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(62, 62, 62, 255), stop:1 rgba(22, 22, 22, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(255, 255, 255); + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); +} +QPushButton:disabled{ + border-style: outset; + border-width: 2px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; + border-style: solid; + color: rgb(0, 0, 0); + padding: 2px; + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(57, 57, 57, 255), stop:1 rgba(77, 77, 77, 255)); +} +QLineEdit { + border-width: 1px; border-radius: 4px; + border-color: rgb(58, 58, 58); + border-style: inset; + padding: 0 8px; + color: rgb(255, 255, 255); + background:rgb(100, 100, 100); + selection-background-color: rgb(187, 187, 187); + selection-color: rgb(60, 63, 65); +} +QLabel { + color:rgb(255,255,255); +} +QProgressBar { + text-align: center; + color: rgb(240, 240, 240); + border-width: 1px; + border-radius: 10px; + border-color: rgb(58, 58, 58); + border-style: inset; + background-color:rgb(77,77,77); +} +QProgressBar::chunk { + background-color: qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 255), stop:1 rgba(93, 103, 113, 255)); + border-radius: 5px; +} +QMenuBar { + background:rgb(82, 82, 82); +} +QMenuBar::item { + color:rgb(223,219,210); + spacing: 3px; + padding: 1px 4px; + background: transparent; +} + +QMenuBar::item:selected { + background:rgb(115, 115, 115); +} +QMenu::item:selected { + color:rgb(255,255,255); + border-width:2px; + border-style:solid; + padding-left:18px; + padding-right:8px; + padding-top:2px; + padding-bottom:3px; + background:qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 255), stop:1 rgba(93, 103, 113, 255)); + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); + border-bottom-color: rgb(58, 58, 58); + border-bottom-width: 1px; +} +QMenu::item { + color:rgb(223,219,210); + background-color:rgb(78,78,78); + padding-left:20px; + padding-top:4px; + padding-bottom:4px; + padding-right:10px; +} +QMenu{ + background-color:rgb(78,78,78); +} +QTabWidget { + color:rgb(0,0,0); + background-color:rgb(247,246,246); +} +QTabWidget::pane { + border-color: rgb(77,77,77); + background-color:rgb(101,101,101); + border-style: solid; + border-width: 1px; + border-radius: 6px; +} +QTabBar::tab { + padding:2px; + color:rgb(250,250,250); + background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); + border-style: solid; + border-width: 2px; + border-top-right-radius:4px; + border-top-left-radius:4px; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(95, 92, 93, 255)); + border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(95, 92, 93, 255)); + border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(95, 92, 93, 255)); + border-bottom-color: rgb(101,101,101); +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + background-color:rgb(101,101,101); + margin-left: 0px; + margin-right: 1px; +} +QTabBar::tab:!selected { + margin-top: 1px; + margin-right: 1px; +} +QCheckBox { + color:rgb(223,219,210); + padding: 2px; +} +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: rgb(87, 97, 106); + background-color:qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 150), stop:1 rgba(93, 103, 113, 150)); +} +QCheckBox::indicator:checked { + border-radius:4px; + border-style:solid; + border-width:1px; + border-color: rgb(180,180,180); + background-color:qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 255), stop:1 rgba(93, 103, 113, 255)); +} +QCheckBox::indicator:unchecked { + border-radius:4px; + border-style:solid; + border-width:1px; + border-color: rgb(87, 97, 106); + background-color:rgb(255,255,255); +} +QStatusBar { + color:rgb(240,240,240); +} diff --git a/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/9.qss b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/9.qss new file mode 100644 index 0000000..92301a5 --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/QSS模板合集/QSS模板合集/9.qss @@ -0,0 +1,531 @@ +/* +ManjaroMix Style Sheet for QT Applications +Author: Jaime A. Quiroga P. +Company: GTRONICK +Last updated: 25/02/2020, 15:42. +Available at: https://github.com/GTRONICK/QSS/blob/master/ManjaroMix.qss +*/ +QMainWindow { + background-color:#151a1e; +} +QCalendar { + background-color: #151a1e; +} +QTextEdit { + border-width: 1px; + border-style: solid; + border-color: #4fa08b; + background-color: #222b2e; + color: #d3dae3; +} +QPlainTextEdit { + border-width: 1px; + border-style: solid; + border-color: #4fa08b; + background-color: #222b2e; + color: #d3dae3; +} +QToolButton { + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: rgb(255,255,255); +} +QToolButton:hover{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(197, 197, 197), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(197, 197, 197)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(255,255,255); +} +QToolButton:pressed{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: rgb(0,0,0); + padding: 2px; + background-color: rgb(142,142,142); +} +QPushButton{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: #151a1e; +} +QPushButton::default{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #FFFFFF; + padding: 2px; + background-color: #151a1e;; +} +QPushButton:hover{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: #1c1f1f; +} +QPushButton:pressed{ + border-style: solid; + border-color: #050a0e; + border-width: 1px; + border-radius: 5px; + color: #d3dae3; + padding: 2px; + background-color: #2c2f2f; +} +QPushButton:disabled{ + border-style: solid; + border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227)); + border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217)); + border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222)); + border-width: 1px; + border-radius: 5px; + color: #808086; + padding: 2px; + background-color: rgb(142,142,142); +} +QLineEdit { + border-width: 1px; + border-style: solid; + border-color: #4fa08b; + background-color: #222b2e; + color: #d3dae3; +} +QLabel { + color: #d3dae3; +} +QLCDNumber { + color: #4d9b87; +} +QProgressBar { + text-align: center; + color: #d3dae3; + border-radius: 10px; + border-color: transparent; + border-style: solid; + background-color: #52595d; +} +QProgressBar::chunk { + background-color: #214037 ; + border-radius: 10px; +} +QMenuBar { + background-color: #151a1e; +} +QMenuBar::item { + color: #d3dae3; + spacing: 3px; + padding: 1px 4px; + background-color: #151a1e; +} + +QMenuBar::item:selected { + background-color: #252a2e; + color: #FFFFFF; +} +QMenu { + background-color: #151a1e; +} +QMenu::item:selected { + background-color: #252a2e; + color: #FFFFFF; +} +QMenu::item { + color: #d3dae3; + background-color: #151a1e; +} +QTabWidget { + color:rgb(0,0,0); + background-color:#000000; +} +QTabWidget::pane { + border-color: #050a0e; + background-color: #1e282c; + border-style: solid; + border-width: 1px; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; +} +QTabBar::tab:first { + border-style: solid; + border-left-width:1px; + border-right-width:0px; + border-top-width:1px; + border-bottom-width:0px; + border-top-color: #050a0e; + border-left-color: #050a0e; + border-bottom-color: #050a0e; + border-top-left-radius: 4px; + color: #d3dae3; + padding: 3px; + margin-left:0px; + background-color: #151a1e; +} +QTabBar::tab:last { + border-style: solid; + border-top-width:1px; + border-left-width:1px; + border-right-width:1px; + border-bottom-width:0px; + border-color: #050a0e; + border-top-right-radius: 4px; + color: #d3dae3; + padding: 3px; + margin-left:0px; + background-color: #151a1e; +} +QTabBar::tab { + border-style: solid; + border-top-width:1px; + border-bottom-width:0px; + border-left-width:1px; + border-top-color: #050a0e; + border-left-color: #050a0e; + border-bottom-color: #050a0e; + color: #d3dae3; + padding: 3px; + margin-left:0px; + background-color: #151a1e; +} +QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { + border-style: solid; + border-left-width:1px; + border-bottom-width:0px; + border-right-color: transparent; + border-top-color: #050a0e; + border-left-color: #050a0e; + border-bottom-color: #050a0e; + color: #FFFFFF; + padding: 3px; + margin-left:0px; + background-color: #1e282c; +} + +QTabBar::tab:selected, QTabBar::tab:first:selected, QTabBar::tab:hover { + border-style: solid; + border-left-width:1px; + border-bottom-width:0px; + border-top-width:1px; + border-right-color: transparent; + border-top-color: #050a0e; + border-left-color: #050a0e; + border-bottom-color: #050a0e; + color: #FFFFFF; + padding: 3px; + margin-left:0px; + background-color: #1e282c; +} + +QCheckBox { + color: #d3dae3; + padding: 2px; +} +QCheckBox:disabled { + color: #808086; + padding: 2px; +} + +QCheckBox:hover { + border-radius:4px; + border-style:solid; + padding-left: 1px; + padding-right: 1px; + padding-bottom: 1px; + padding-top: 1px; + border-width:1px; + border-color: transparent; +} +QCheckBox::indicator:checked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #4fa08b; + color: #000000; + background-color: qradialgradient(cx:0.4, cy:0.4, radius: 1.5,fx:0, fy:0, stop:0 #1e282c, stop:0.3 #1e282c, stop:0.4 #4fa08b, stop:0.5 #1e282c, stop:1 #1e282c); +} +QCheckBox::indicator:unchecked { + + height: 10px; + width: 10px; + border-style:solid; + border-width: 1px; + border-color: #4fa08b; + color: #000000; +} +QRadioButton { + color: #d3dae3; + padding: 1px; +} +QRadioButton::indicator:checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #4fa08b; + color: #a9b7c6; + background-color: qradialgradient(cx:0.5, cy:0.5, radius:0.4,fx:0.5, fy:0.5, stop:0 #4fa08b, stop:1 #1e282c); +} +QRadioButton::indicator:!checked { + height: 10px; + width: 10px; + border-style:solid; + border-radius:5px; + border-width: 1px; + border-color: #4fa08b; + color: #a9b7c6; + background-color: transparent; +} +QStatusBar { + color:#027f7f; +} +QSpinBox { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QDoubleSpinBox { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QTimeEdit { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QDateTimeEdit { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QDateEdit { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QFontComboBox { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} +QComboBox { + color: #d3dae3; + background-color: #222b2e; + border-width: 1px; + border-style: solid; + border-color: #4fa08b; +} + +QDial { + background: #16a085; +} + +QToolBox { + color: #a9b7c6; + background-color: #222b2e; +} +QToolBox::tab { + color: #a9b7c6; + background-color:#222b2e; +} +QToolBox::tab:selected { + color: #FFFFFF; + background-color:#222b2e; +} +QScrollArea { + color: #FFFFFF; + background-color:#222b2e; +} +QSlider::groove:horizontal { + height: 5px; + background-color: #52595d; +} +QSlider::groove:vertical { + width: 5px; + background-color: #52595d; +} +QSlider::handle:horizontal { + background: #1a2224; + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + width: 12px; + margin: -5px 0; + border-radius: 7px; +} +QSlider::handle:vertical { + background: #1a2224; + border-style: solid; + border-width: 1px; + border-color: rgb(207,207,207); + height: 12px; + margin: 0 -5px; + border-radius: 7px; +} +QSlider::add-page:horizontal { + background: #52595d; +} +QSlider::add-page:vertical { + background: #52595d; +} +QSlider::sub-page:horizontal { + background-color: #15433a; +} +QSlider::sub-page:vertical { + background-color: #15433a; +} +QScrollBar:horizontal { + max-height: 10px; + border: 1px transparent grey; + margin: 0px 20px 0px 20px; + background: transparent; +} +QScrollBar:vertical { + max-width: 10px; + border: 1px transparent grey; + margin: 20px 0px 20px 0px; + background: transparent; +} +QScrollBar::handle:horizontal { + background: #52595d; + border-style: transparent; + border-radius: 4px; + min-width: 25px; +} +QScrollBar::handle:horizontal:hover { + background: #58a492; + border-style: transparent; + border-radius: 4px; + min-width: 25px; +} +QScrollBar::handle:vertical { + background: #52595d; + border-style: transparent; + border-radius: 4px; + min-height: 25px; +} +QScrollBar::handle:vertical:hover { + background: #58a492; + border-style: transparent; + border-radius: 4px; + min-height: 25px; +} +QScrollBar::add-line:horizontal { + border: 2px transparent grey; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + background: #15433a; + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:horizontal:pressed { + border: 2px transparent grey; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(181,181,181); + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical { + border: 2px transparent grey; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: #15433a; + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::add-line:vertical:pressed { + border: 2px transparent grey; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(181,181,181); + height: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal { + border: 2px transparent grey; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + background: #15433a; + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:horizontal:pressed { + border: 2px transparent grey; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + background: rgb(181,181,181); + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical { + border: 2px transparent grey; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + background: #15433a; + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} +QScrollBar::sub-line:vertical:pressed { + border: 2px transparent grey; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + background: rgb(181,181,181); + height: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} + +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { + background: none; +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: none; +} diff --git a/qss样式表/a6223-main/a6223-main/README.md b/qss样式表/a6223-main/a6223-main/README.md new file mode 100644 index 0000000..a836fa7 --- /dev/null +++ b/qss样式表/a6223-main/a6223-main/README.md @@ -0,0 +1,41 @@ +# QSS样式表模板集合 + +## 项目简介 + +欢迎来到QSS(Qt Style Sheets)样式表模板库!本仓库精心整理并提供了17种独特的QSS样式设计,专为那些寻求提升其Qt应用界面美观度的开发者们准备。无论是希望快速为您的应用程序披上现代外观,还是寻找灵感来定制独特的用户交互体验,这个资源都是您宝贵的工具箱。 + +## 特色样式表 + +本集合覆盖了广泛的UI风格,从简洁的扁平化设计到模拟材料设计的深度感,以及过渡动画等高级效果,旨在满足不同项目的视觉需求: + +1. **扁平化主题** - 清爽的色彩与极简线条。 +2. **深色模式** - 适合夜间使用的优雅风格。 +3. **高亮按钮** - 触发时视觉反馈强烈的效果。 +4. **渐变背景** - 动态颜色变化,增加界面活力。 +5. **圆形元素** - 适用于图标、按钮等,增添柔和触感。 +6. **材质风格** - 谷歌 Material Design 的QSS实现。 +7. **透明效果** - 让组件与背景融合,创造轻盈感觉。 +8. **复古设计** - 带用户回到经典时代的界面风格。 +9. **滑动条定制** - 美观且直观的自定义滑块。 +10. 至17. 更多种类,包含对话框、菜单、表格视图等特定组件的美化示例。 + +## 使用指南 + +- **导入**: 将下载的QSS文件放入您的项目资源中。 +- **应用**: 在Qt应用程序中,通过`QWidget::setStyleSheet()`方法应用样式表。 +- **定制**: 根据需要调整颜色、大小等属性,以完全符合您的品牌和设计规范。 +- **兼容性**: 确保所用的Qt版本与样式表兼容,以便最佳显示效果。 + +## 注意事项 + +- 请在实际应用前测试每个样式表,确保它们与您的应用逻辑和谐共存。 +- 鼓励贡献与反馈:如果您有新的模板或对现有模板的改进意见,欢迎提交PR或创建Issue讨论。 +- 版权信息:请注意版权及使用许可,尊重原创作者的工作。 + +## 开始使用 + +立即下载这些QSS模板,开始打造您独一无二的Qt应用程序界面,让用户体验更上一层楼! + +--- + +此仓库是为追求完美UI体验的开发者量身定做的宝库,让我们一起探索界面美学的无限可能! \ No newline at end of file diff --git a/qss样式表/bdc27-main.zip b/qss样式表/bdc27-main.zip new file mode 100644 index 0000000..e5d21cb Binary files /dev/null and b/qss样式表/bdc27-main.zip differ diff --git a/qss样式表/bdc27-main/bdc27-main/LICENSE b/qss样式表/bdc27-main/bdc27-main/LICENSE new file mode 100644 index 0000000..63b4b68 --- /dev/null +++ b/qss样式表/bdc27-main/bdc27-main/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [year] [fullname] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/qss样式表/bdc27-main/bdc27-main/My_Qss.zip b/qss样式表/bdc27-main/bdc27-main/My_Qss.zip new file mode 100644 index 0000000..9f3f6bd Binary files /dev/null and b/qss样式表/bdc27-main/bdc27-main/My_Qss.zip differ diff --git a/qss样式表/bdc27-main/bdc27-main/README.md b/qss样式表/bdc27-main/bdc27-main/README.md new file mode 100644 index 0000000..f4a8109 --- /dev/null +++ b/qss样式表/bdc27-main/bdc27-main/README.md @@ -0,0 +1,27 @@ +# 【精选QSS资源】一站式获取高质量QT界面美化素材 + +## 概览 +欢迎来到“精选QSS资源”仓库,这里汇集了互联网上超过30份精心挑选的QSS(Qt Style Sheets)资源。QSS类似于网页设计中的CSS,它使得开发者能够以灵活的方式定制和美化Qt应用程序的用户界面。无论你是Qt初学者还是经验丰富的开发者,这个资源库都能帮助你轻松提升应用的视觉效果。 + +## 特色内容 +- **丰富资源**:集合了超30款风格各异的QSS样式表,覆盖简洁现代到专业商务等多种设计风。 +- **即拿即用**:每个QSS文件都经过基础测试,可以直接应用于你的Qt项目,加速界面开发进程。 +- **包含教程**:不仅有样式文件,还有入门指导和使用技巧,即使是新手也能快速上手QSS。 +- **持续更新**:我们会根据反馈和资源的新颖度定期更新资源库,确保您获得的始终是最有价值的资料。 + +## 使用指南 +1. **下载资源**:首先,将本仓库的QSS文件下载到本地。 +2. **了解基本**:建议先阅读随资源提供的ReadMe文档,了解如何在Qt项目中正确引用和应用QSS。 +3. **集成应用**:在Qt Designer或代码中引入选定的QSS文件,按照教程步骤操作即可美化界面。 +4. **自定义调整**:根据需要,你可以对QSS进行修改,定制出符合项目特性的独特风格。 + +## 注意事项 +- 请在使用任何资源前确认其适用性和兼容性,特别是针对不同的Qt版本。 +- 鼓励社区交流和反馈,如果遇到问题或者有好的资源推荐,欢迎贡献! + +## 结语 +通过此资源库,我们希望每位Qt开发者都能够更加便捷地打造出既美观又功能强大的应用程序界面。现在就开始探索,让你的应用焕然一新吧!如果你觉得这些资源对你有所帮助,记得分享给更多的开发者朋友,一起提升我们的项目品质。 + +--- + +本仓库是视觉设计与技术实现的桥梁,让您的Qt项目在美学和技术上达到新的高度。开始你的界面美化之旅,从这里启航! \ No newline at end of file diff --git a/图像结构.jpg b/图像结构.jpg new file mode 100644 index 0000000..8b2a73d Binary files /dev/null and b/图像结构.jpg differ