Merge pull request 'RTPC-dev' (#3) from RTPC-dev into Release

Reviewed-on: http://123.153.4.249:22779/LAMPSARToolSoftware/RasterProcessTool/pulls/3
Release
chenzenghui 2025-02-10 02:20:06 +08:00
commit 3401d7c6f6
274 changed files with 16196 additions and 4944 deletions

45
.gitignore vendored
View File

@ -17,24 +17,25 @@
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
**/**/[Dd]ebug/
**/**/[Dd]ebugPublic/
**/**/[Rr]elease/
**/**/[Rr]eleases/
**/**/x64/
**/**/x86/
**/**/[Ww][Ii][Nn]32/
**/**/[Aa][Rr][Mm]/
**/**/[Aa][Rr][Mm]64/
**/**/bld/
**/**/[Bb]in/
**/**/[Oo]bj/
**/**/[Oo]ut/
**/**/[Ll]og/
**/**/[Ll]ogs/
**/Releases
# Visual Studio 2015/2017 cache/options directory
.vs/
**/.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
@ -42,8 +43,8 @@ bld/
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
**/[Tt]est[Rr]esult*/
**/[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
@ -51,8 +52,8 @@ TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
**/[Dd]ebugPS/
**/[Rr]eleasePS/
dlldata.c
# Benchmark Results
@ -97,7 +98,9 @@ StyleCopReport.xml
*.pidb
*.svclog
*.scc
**.tlog
*.tlog
*.idb
# Chutzpah Test files
_Chutzpah*

20
ALLRelease/ALLRelease.cpp Normal file
View File

@ -0,0 +1,20 @@
// ALLRelease.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
}
// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
// 调试程序: F5 或调试 >“开始调试”菜单
// 入门使用技巧:
// 1. 使用解决方案资源管理器窗口添加/管理文件
// 2. 使用团队资源管理器窗口连接到源代码管理
// 3. 使用输出窗口查看生成输出和其他消息
// 4. 使用错误列表窗口查看错误
// 5. 转到“项目”>“添加新项”以创建新的代码文件,或转到“项目”>“添加现有项”以将现有代码文件添加到项目
// 6. 将来,若要再次打开此项目,请转到“文件”>“打开”>“项目”并选择 .sln 文件

View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{8a71d19d-9ac6-42e9-81ec-9e82af8075b8}</ProjectGuid>
<RootNamespace>ALLRelease</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp14</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="ALLRelease.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BaseCommonLibrary\BaseCommonLibrary.vcxproj">
<Project>{872ecd6f-30e3-4a1b-b17c-15e87d373ff6}</Project>
</ProjectReference>
<ProjectReference Include="..\GPUBaseLib\GPUBaseLib.vcxproj">
<Project>{b8b40c54-f7fe-4809-b6fb-8bc014570d7b}</Project>
</ProjectReference>
<ProjectReference Include="..\LAMPDataProcessEXE\LAMPDataProcessEXE.vcxproj">
<Project>{4e6e79a3-048c-4fb4-bbb0-43c518a3e6d4}</Project>
</ProjectReference>
<ProjectReference Include="..\LAMPSARProcessProgram\RasterProcessTool.vcxproj">
<Project>{7ef67daa-dbc0-4b7f-80e8-11b4d2cb7ec2}</Project>
</ProjectReference>
<ProjectReference Include="..\RasterMainWidgetGUI\RasterMainWidgetGUI.vcxproj">
<Project>{e56b3878-a3dc-41a4-abf3-b628816d0d64}</Project>
</ProjectReference>
<ProjectReference Include="..\Toolbox\BaseToolbox\BaseToolbox.vcxproj">
<Project>{070c157e-3c30-4e2b-a80c-cbc7b74df03f}</Project>
</ProjectReference>
<ProjectReference Include="..\Toolbox\ImageshowTool\ImageshowTool.vcxproj">
<Project>{8c8ca066-a93a-4098-9a46-b855efeaadf2}</Project>
</ProjectReference>
<ProjectReference Include="..\Toolbox\LAMPScatterTool\LAMPScatterTool.vcxproj">
<Project>{d603a623-132d-4304-ab03-638fc438f084}</Project>
</ProjectReference>
<ProjectReference Include="..\Toolbox\SimulationSARTool\SimulationSARTool.vcxproj">
<Project>{ed06dfcd-4b9f-41f7-8f25-1823c2398142}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ALLRelease.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,429 @@
<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" FontFamily="Segoe UI" FontSize="12">
<FlowDocument.Tag><![CDATA[{
"timestamp": "2025-02-02 17:23:02",
"files": {
"C:\\Users\\30453\\Desktop\\RasterTool\\RasterProcessTool\\BaseCommonLibrary\\BaseCommonLibrary.vcxproj": {
"before": "7Vpbb9s2FO7zgP0HQ8iQ5CFWHHdJscgqEjnJjDmX2blsQIGClmhbqyQKFJUmW/d39jt3KF5kOVItIW2yFelDUZPnO6QOv3Mj+8/aq1fW27swaN1imvgk6hmd9rbRwpFLPD+a9YyUTbfeGG/t77+zLij5A7us1cdTlAbsEtEZZknPOEz9wDNaoCWCX3PG4p9MM3HnOERJO/RdShIyZW2XhKaHb3FAYkzNMJlwmLmzvd01QHurZQ0YDk8oSePWEE1w0DPkgg6Jpv4spYjBBhMhDOJls61B5Aaph3tGH0/S2acbP+ruKARgCqrsTMYyi4N8K/yPdREgNiU0tDMllql/CwkYEPYog6/Y3AgHGCV4xfak1HNsUFjvbvf1Y20HKr6K5T63tdp2a7g5y9QMFYQFAgCV2X2BtCcBmaAgp+m1I3lyLTzM7uy1ty3zwbBk1S/4/iOhniAdR1qmGpISUt1J6nv2X2/2drDr7U63utu4u/UadSZbk86eu9X5Eb/Z87p73el0929N1Qwj1YwIYWcoxEmMXGwfAh0dEoYkGvoTiui9ZRYFJAp8wSMfE+H7yiP0l23zL/usCFeTbSc3nHT+MCaUteTH9Yy1jWtHRpgLxOab7051IHHiuC1jUDuGI0iMlll2IOCYns9jRs9YX9souOnmp7UNtfvN9V5vfSFcrBsq/hQgyhOKMeTyPsZ2/z5CEOe05Qq4TEJa7yrB2UJC0seJzWiKLfPhuASoPV4SEiSY2bed193cn9SoFHbmiCKXYToGyavIhxAOugujleYHu+cn0mpiuUIse1LbTcHNvpjxbuYkwGCFGUXhecz80P8zyzfyhCqnn9X2Okw/qd2/Hc5CAnhSy30rjB00C9bFIC3AhZx5dMdwxMtPiFwMyk6ZPSHhZgtlsotpogAeQ9jDngjP9RAq2I3nGApYo1G4KySKbE+Q0B7aAyI65Qm079Pl1LWQedopiKkcthB08Z2fsGQDslZjPeubOn0NiYuCgzjuI4ZUItGpspZpH2OopbzwYirdwlQUH1kwejFTtZkUo749Qyk/K8Q17vqniHfP2mmLcgsBY2V9W2470Szz+tpum7wF4BXl/tqG7KKzwhtC6oJYZQHJWyMoyv0oq7jFhzTZYGlcdQLoSWI/wNItINTeIBpBhhjyiwQ7+xsK4sKgqMhAdNwfOnPsfpAlnP6pBS4ojilxcZIQmu89sW8GZ92d/ff9o8Ork/3Dg/GRc356en42HByODka/vz/67eJ8dDnefw9y/fMb+MfVeNQfDvd/2KjQuMlbnvK19GbAWPy2AUUuPoXCXW56eVSLgz64UOG28X7GyMPUBr5kyywNVyOOuWFjd96el+CySYGFHmLpHKyhH33Iz2ScTsb3CRCAd628PbTMfEivf4IjDHc4ogMaiI/l3Zn80sppreAoQpMAXx04tqyj8gG1Ub0v0avnh7pYQjySqcqVsmuh9bwtXLJRM64ep5HLjZExmn8FcFwapnRKG2UQMepD7eQqMdVTlkxokHYFUcrrn1qgiq3CM85ePEMR7ot4huAxBJn+weUxCfjFqzz7shl9SLJNxSM8xRRubPV1QsmEBlW6maBC5bRWkDvds3rhQuuraqbls2jmgdoJmvrES55QB/CSJ+STQXalqPJEoVx9HEdVjP+PZ4n/W344I+wqgaBbUgblRc6DguuJy6eyVCBCVdmMDtcluUCgSiY0qDILPEOSyCs3iOdOIJuR/KFPtS3vxBNGlLBrRH1eKbbnqnGqgeSdT23AkTsn/FblmBfsrDaMM+YcrtkRI7Q26ASTxphBiGZ6JW6X2qsNyYyX5k6Q1Ib8yk0HnSnvow4R7fsoILPa6BGCxoFyFY32OT4Yjf0whXgLRXP2ucNO7TUT5qHp3SrxKbwEYHiL+7BKMGuhFNVE45GTNn/VVllSp4AKDmdMdONYaczIK/vgEsgSF+sDC2ysD1vkY33UQ0bWxy5wsj6onJX18Uu8rA8sZWZ9uOTmSoAXBCHyo/ZKQc5OLvSZTNboArxY1jgUQ0vfLHE2Wq54L/REy4mS7asvpkypbhJWLbh8EbM61pyRCJfEjHLnSH0Vch4qbvbgw8R/DdLqFp5x1Nu6fvKRj/zl7zecWNl/OrL/BQ==",
"after": "7Vpbb9s2FO7zgP0HTciQZFisJO6aorFVJHaSGrNzsXPZgAABLdG2VknUKCqNt+59P3uH4sWWLcXy0qTXPXQxec4hefidK/XvT8+e1V7fBb5xi2nskbBublU2TQOHDnG9cFg3EzbYeGm+tr//rnZKyR/YYUYTD1Dis3NEh5jFdXM/8XzXNEBKCL9GjEWvLCt2RjhAcSXwHEpiMmAVhwSWi2+xTyJMrSDuczZre3OzaoJ0w6i1GA6OKEkio4362K+bcsEGCQfeMKGIwQZjQQzkebNGK3T8xMV1s4n7yfD9lRdWtxUH8GRE2SlNzcoO8q3w/2qnPmIDQgM7FVKz9G9BAQNCH3nsCzbXxT5GMV6wPUn1MTYotHf34vlDdQciHkVz922ttN6W3FzN0ggVgAUAAJTZOAPaI5/0kT+B6WVD4uRSWJi9tVPZrFlzwxJVv+LxO0JdATrOWbPUkKSQ4o4Sz7X/frmzjR33xWCjuomrG8/RVn+jv7XjbGz9gl/uuNWd6mDw4h8N1ZRHiukSwo5RgOMIOdjeBzg2SBCQsO31KaLjmpUlkFxgCy55FwvbVxahT7bJT3Yvycwpz9hl7+a2ugkgmTnlGevEqWMxwL5cj5t+3VxdWdPj66v1+uqqcdI1fji482IWr2Vmr/9kFSY81Oq6aa+sdXqpOKm9pkfBlRE6Xr/WEmuW/lPcL7fwyQVLJxVEhDJDiqmbK2uXDekJTxEbrV93tMNrRFFF+spKBJJi07DygJM9YMadrL9fWVNaTg885dZWTeUnMyzKYrO+7nwcYbs5DhH4Y33DGb6UQl7PRYzThQSlh2Ob0QTXrPlxyaD2eE6IH2Nm3249r07sXo1K4sYIUeQwTHtAeRF6EGpAdmaUU6aonVV/5kZmoJE5zpzmMj73SXU3AHfwwZR3NSI+Bi0MKQpOIuYF3l9pXJQ3VDj9UXWvw8mT6v3LwSwEqifV3JeC2NZyzjrrpOeZdXhYh+hy44o0OFa+HdyPilMFAWmGBeJSfkCQ6e8ZAwfJIAuHwDElHMLc/Z4uGyNyQ84DV5j1pY+xxrTPeAz56gzCtuQKIpIbPC+qm/q6jwk7JEkINc4+hooAy3hfNxtJzEiQ5hW7DR/yp8jzceayFucmxRnMGRPQ4vmLdN8dHMdoiA2BTRQ6sM033nBkGuf4jk1t+ZXhkMR3jZAwwycOYtiYJEQ/879TsO8a8L+0qAvQOCVOqzJgpjw/8scVDVFLnHo6C8rkvQd3DIe8hNSgtSFhTg0wpStk7EE6gF2zJDWEvjQn6I0wFJ8ZXS9nGEql82YOWQ7lyS/kiLPp3FQ2VkmALMf2sU5Gl5bDHYK0zDbcmb8XRU3EkEqu1FVAajS/aQ1WntCqbUlUl7qGhyhW2VJaKa9qtM7vcmmVZC74a1TtlBv8hliW8TgfArGp9/+qFau0mFEtt9MO4p075XR4R2tSjC2VjyjvkNW1aNTxmtmuWLz9wKvE3ZU12cFLi2kIIFNkhUUhb8tAoe2FaZtAHOR/J0wKDDqeywHwuleIhpCOtXkT007/hSI3MyjCNJD2mu3GCDtvZVmmf2qCU4ojShyI54RO9h7bV63j6vbuTfNg/+Jod3+vd9A46XROjtut/e5e9/ebg99OT7rnvd0boGueXMEfF71us93e/XGtQOI6r6Pz19Kb4fkkdDp5PtGBYlxuenZUk4M8aObyXMd9g5GLqQ14SZeZGS7mOARmO3JGlVEOXzqpeTvQa/YAfUJXIsmaLnmL54UIaC2o1EzdbdsL306utZf0e+MYMMSbbry7VbMmQ3obRzjE0IIWjZGW0BfvSkllFU5rAQch6vv4Yq9hy/JqMqA2qvclWo0TXExnUA8Eu7LGmVg9q6Pl4H6YhA5XRmoU/BRgJlIxuVNaKa2QUQ/SRkeRqVZTzoRm0tYkKnz9UxMUAV4Y1/E349KaKjYeodvieSHiAxmXMAVwdc2980Pi86cnCZ+8Gb172QDDXTzAFN6sdKMyZ0IzFVqqOHHhtBYwsduPasg5meHDjFjb0bJm9S1aTYJJscE8qUEVovgzA7mKVpnc8WEwV5HmE49Vn1uUgibZRQx+Oyefm1jHXOb4+eWBeQFJGFXejA4aORFJcOVMaKZPyYonKSikhg1fFmaTDy5UCXctnpLDmF0i6vGUtwLtSdGJKsHJq8DSDAfOiPAO2SEvXlhpNg66EyhmETwAl2Y6wmRpnlYAzVrFxfVSerU2GfIao+HHpVnOuOpknbSPaNNDPhmW5u4iqIAoF7HUPnt73Z4XJPCpDGT/6XHbW6XXjJmLBneLyAfw0onhm4i3iwjTclJBbe5jjey3GykSZcO+AMMpEp0oUhIXsMxgsTxjBo3l2abxWJ5rHpHleacwWZ4pH5Xl+WdwWZ4xF5nl2SU2FzK4vh8gL6wsJOTo5ET3BMMHdNUaFENvYrnYu9RymUdF+4mWE1nfoy+mkkzVElm04GzRu9jXHJMQHu1ELxM+mJTdzut840g85XLmBS/3oM3EB1Ba3PyDzNSz0eR9MPPoUvCWPfVxlXrEFtIzfWT9KCifTOdf+Thk0xdI+z8="
}
}
}]]></FlowDocument.Tag>
<Section Margin="0,24" TextAlignment="Center">
<Paragraph FontSize="24" FontWeight="Bold" Margin="12,0">
<LineBreak />
<Span Foreground="Gray">Qt Visual Studio Tools</Span>
</Paragraph>
<Paragraph FontSize="42" Margin="12,0" FontWeight="Bold">
<Span TextDecorations="Underline">Project Format Conversion</Span>
</Paragraph>
<Paragraph Margin="12,8" FontSize="18">
<Span>Report generated on 2025-02-02 17:23:02</Span>
</Paragraph>
</Section>
<Section>
<Paragraph FontSize="32" FontWeight="Bold" Margin="12,0">
<Span>Files</Span>
</Paragraph>
<Paragraph Margin="24,12,0,0">
<Span FontFamily="Consolas" FontSize="14" Background="WhiteSmoke"><![CDATA[C:\Users\30453\Desktop\RasterTool\RasterProcessTool\BaseCommonLibrary\BaseCommonLibrary.vcxproj]]></Span>
<LineBreak />
<Hyperlink NavigateUri="file://C:\Users\30453\Desktop\RasterTool\RasterProcessTool\BaseCommonLibrary\BaseCommonLibrary.vcxproj?before">[Before]</Hyperlink>
<Hyperlink NavigateUri="file://C:\Users\30453\Desktop\RasterTool\RasterProcessTool\BaseCommonLibrary\BaseCommonLibrary.vcxproj?after">[After]</Hyperlink>
<Hyperlink NavigateUri="file://C:\Users\30453\Desktop\RasterTool\RasterProcessTool\BaseCommonLibrary\BaseCommonLibrary.vcxproj?diff&amp;before&amp;after">
[Diff before/after]
</Hyperlink>
<Hyperlink NavigateUri="file://C:\Users\30453\Desktop\RasterTool\RasterProcessTool\BaseCommonLibrary\BaseCommonLibrary.vcxproj?diff&amp;before&amp;current">
[Diff before/current]
</Hyperlink>
<Hyperlink NavigateUri="file://C:\Users\30453\Desktop\RasterTool\RasterProcessTool\BaseCommonLibrary\BaseCommonLibrary.vcxproj?diff&amp;after&amp;current">
[Diff after/current]
</Hyperlink>
<LineBreak />
</Paragraph>
</Section>
<Section>
<Paragraph FontSize="32" FontWeight="Bold" Margin="12,0">
<Span>Changes</Span>
</Paragraph>
<Paragraph FontSize="20" FontWeight="Bold" Margin="12">
<Span><![CDATA[🡺 Enabling multi-processor compilation]]></Span>
</Paragraph>
<Table CellSpacing="0" BorderBrush="Gray" BorderThickness="0.5">
<Table.Columns>
<TableColumn />
<TableColumn />
</Table.Columns>
<TableRowGroup>
<TableRow Background="Orange">
<TableCell ColumnSpan="2" BorderThickness="0.5" BorderBrush="Gray">
<Paragraph Margin="10,5" FontWeight="Bold">
<Span><![CDATA[C:\Users\30453\Desktop\RasterTool\RasterProcessTool\BaseCommonLibrary\BaseCommonLibrary.vcxproj]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="0.5" />
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[      <MultiProcessorCompilation>true</MultiProcessorCompilation>]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="0.5" />
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[      <MultiProcessorCompilation>true</MultiProcessorCompilation>]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="0.5" />
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[      <MultiProcessorCompilation>true</MultiProcessorCompilation>]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="0.5" />
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[      <MultiProcessorCompilation>true</MultiProcessorCompilation>]]></Span>
</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
<Paragraph FontSize="20" FontWeight="Bold" Margin="12">
<Span><![CDATA[🡺 Project format version]]></Span>
</Paragraph>
<Table CellSpacing="0" BorderBrush="Gray" BorderThickness="0.5">
<Table.Columns>
<TableColumn />
<TableColumn />
</Table.Columns>
<TableRowGroup>
<TableRow Background="Orange">
<TableCell ColumnSpan="2" BorderThickness="0.5" BorderBrush="Gray">
<Paragraph Margin="10,5" FontWeight="Bold">
<Span><![CDATA[C:\Users\30453\Desktop\RasterTool\RasterProcessTool\BaseCommonLibrary\BaseCommonLibrary.vcxproj]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="0.5" />
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[    <Keyword>QtVS_v304</Keyword>]]></Span>
</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
<Paragraph FontSize="20" FontWeight="Bold" Margin="12">
<Span><![CDATA[🡺 Fallback for QTMSBUILD environment variable]]></Span>
</Paragraph>
<Table CellSpacing="0" BorderBrush="Gray" BorderThickness="0.5">
<Table.Columns>
<TableColumn />
<TableColumn />
</Table.Columns>
<TableRowGroup>
<TableRow Background="Orange">
<TableCell ColumnSpan="2" BorderThickness="0.5" BorderBrush="Gray">
<Paragraph Margin="10,5" FontWeight="Bold">
<Span><![CDATA[C:\Users\30453\Desktop\RasterTool\RasterProcessTool\BaseCommonLibrary\BaseCommonLibrary.vcxproj]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="0.5" />
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[    <QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>]]></Span>
</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
<Paragraph FontSize="20" FontWeight="Bold" Margin="12">
<Span><![CDATA[🡺 Default Qt properties]]></Span>
</Paragraph>
<Table CellSpacing="0" BorderBrush="Gray" BorderThickness="0.5">
<Table.Columns>
<TableColumn />
<TableColumn />
</Table.Columns>
<TableRowGroup>
<TableRow Background="Orange">
<TableCell ColumnSpan="2" BorderThickness="0.5" BorderBrush="Gray">
<Paragraph Margin="10,5" FontWeight="Bold">
<Span><![CDATA[C:\Users\30453\Desktop\RasterTool\RasterProcessTool\BaseCommonLibrary\BaseCommonLibrary.vcxproj]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="0.5" />
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[  <Import Project="$(QtMsBuild)\qt_defaults.props" Condition="Exists('$(QtMsBuild)\qt_defaults.props')" />]]></Span>
</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
<Paragraph FontSize="20" FontWeight="Bold" Margin="12">
<Span><![CDATA[🡺 Qt build settings]]></Span>
</Paragraph>
<Table CellSpacing="0" BorderBrush="Gray" BorderThickness="0.5">
<Table.Columns>
<TableColumn />
<TableColumn />
</Table.Columns>
<TableRowGroup>
<TableRow Background="Orange">
<TableCell ColumnSpan="2" BorderThickness="0.5" BorderBrush="Gray">
<Paragraph Margin="10,5" FontWeight="Bold">
<Span><![CDATA[C:\Users\30453\Desktop\RasterTool\RasterProcessTool\BaseCommonLibrary\BaseCommonLibrary.vcxproj]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="0.5" />
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[  <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[  <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[  <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[  <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />]]></Span>
</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
<Paragraph FontSize="20" FontWeight="Bold" Margin="12">
<Span><![CDATA[🡺 Warn if Qt/MSBuild is not found]]></Span>
</Paragraph>
<Table CellSpacing="0" BorderBrush="Gray" BorderThickness="0.5">
<Table.Columns>
<TableColumn />
<TableColumn />
</Table.Columns>
<TableRowGroup>
<TableRow Background="Orange">
<TableCell ColumnSpan="2" BorderThickness="0.5" BorderBrush="Gray">
<Paragraph Margin="10,5" FontWeight="Bold">
<Span><![CDATA[C:\Users\30453\Desktop\RasterTool\RasterProcessTool\BaseCommonLibrary\BaseCommonLibrary.vcxproj]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="0.5" />
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[  <Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') OR !Exists('$(QtMsBuild)\Qt.props')">]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[    <Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[  </Target>]]></Span>
</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
<Paragraph FontSize="20" FontWeight="Bold" Margin="12">
<Span><![CDATA[🡺 Qt property sheet]]></Span>
</Paragraph>
<Table CellSpacing="0" BorderBrush="Gray" BorderThickness="0.5">
<Table.Columns>
<TableColumn />
<TableColumn />
</Table.Columns>
<TableRowGroup>
<TableRow Background="Orange">
<TableCell ColumnSpan="2" BorderThickness="0.5" BorderBrush="Gray">
<Paragraph Margin="10,5" FontWeight="Bold">
<Span><![CDATA[C:\Users\30453\Desktop\RasterTool\RasterProcessTool\BaseCommonLibrary\BaseCommonLibrary.vcxproj]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="0.5" />
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[    <Import Project="$(QtMsBuild)\Qt.props" />]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="0.5" />
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[    <Import Project="$(QtMsBuild)\Qt.props" />]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="0.5" />
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[    <Import Project="$(QtMsBuild)\Qt.props" />]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="0.5" />
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[    <Import Project="$(QtMsBuild)\Qt.props" />]]></Span>
</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
<Paragraph FontSize="20" FontWeight="Bold" Margin="12">
<Span><![CDATA[🡺 Qt targets]]></Span>
</Paragraph>
<Table CellSpacing="0" BorderBrush="Gray" BorderThickness="0.5">
<Table.Columns>
<TableColumn />
<TableColumn />
</Table.Columns>
<TableRowGroup>
<TableRow Background="Orange">
<TableCell ColumnSpan="2" BorderThickness="0.5" BorderBrush="Gray">
<Paragraph Margin="10,5" FontWeight="Bold">
<Span><![CDATA[C:\Users\30453\Desktop\RasterTool\RasterProcessTool\BaseCommonLibrary\BaseCommonLibrary.vcxproj]]></Span>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="0.5" />
</TableRow>
<TableRow>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0" />
</TableCell>
<TableCell BorderThickness="0, 0, 0.5, 0" BorderBrush="Gray">
<Paragraph FontFamily="Consolas" Margin="4, 0">
<Span Background="LightGreen"><![CDATA[  <Import Project="$(QtMsBuild)\qt.targets" Condition="Exists('$(QtMsBuild)\qt.targets')" />]]></Span>
</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</Section>
<Section>
<Paragraph />
</Section>
</FlowDocument>
<!--tt6O+8R3ZB6prOXbquQ12IXqTLK9S8iJYIu6TuYJVVk=-->

View File

@ -0,0 +1,222 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{872ecd6f-30e3-4a1b-b17c-15e87d373ff6}</ProjectGuid>
<RootNamespace>BaseCommonLibrary</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<Keyword>QtVS_v304</Keyword>
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(QtMsBuild)\qt_defaults.props" Condition="Exists('$(QtMsBuild)\qt_defaults.props')" />
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<QtModules>core;gui;widgets</QtModules>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QtModules>core;gui;widgets</QtModules>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtModules>core;gui;widgets</QtModules>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtModules>core;xml;sql;opengl;gui;svg;xmlpatterns;widgets;location;positioning;openglextensions;charts</QtModules>
<QtPlugin>false</QtPlugin>
<QtInstall>tools_qt5</QtInstall>
</PropertyGroup>
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') OR !Exists('$(QtMsBuild)\Qt.props')">
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
</Target>
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>./BaseTool;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;BASECONSTVARIABLE_API;_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<OpenMPSupport>true</OpenMPSupport>
<LanguageStandard>stdcpp14</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
<CudaCompile>
<GenerateRelocatableDeviceCode>true</GenerateRelocatableDeviceCode>
<CodeGeneration>compute_82,sm_82</CodeGeneration>
</CudaCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="BaseTool\BaseConstVariable.h" />
<ClInclude Include="BaseTool\BaseTool.h" />
<ClInclude Include="BaseTool\EchoDataFormat.h" />
<ClInclude Include="BaseTool\FileOperator.h" />
<ClInclude Include="BaseTool\GeoOperator.h" />
<ClInclude Include="BaseTool\ImageOperatorBase.h" />
<ClInclude Include="BaseTool\LogInfoCls.h" />
<QtMoc Include="ToolAbstract\QToolAbstract.h" />
<QtMoc Include="BaseTool\QToolProcessBarDialog.h" />
<ClInclude Include="BaseTool\RasterToolBase.h" />
<ClInclude Include="BaseTool\SARSimulationImageL1.h" />
<ClInclude Include="BaseTool\stdafx.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="BaseTool\BaseTool.cpp" />
<ClCompile Include="BaseTool\EchoDataFormat.cpp" />
<ClCompile Include="BaseTool\FileOperator.cpp" />
<ClCompile Include="BaseTool\GeoOperator.cpp" />
<ClCompile Include="BaseTool\ImageOperatorBase.cpp" />
<ClCompile Include="BaseTool\LogInfoCls.cpp" />
<ClCompile Include="BaseTool\QToolProcessBarDialog.cpp" />
<ClCompile Include="BaseTool\RasterToolBase.cpp" />
<ClCompile Include="BaseTool\SARSimulationImageL1.cpp" />
<ClCompile Include="BaseTool\stdafx.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="ToolAbstract\QToolAbstract.cpp" />
</ItemGroup>
<ItemGroup>
<QtUic Include="BaseTool\QToolProcessBarDialog.ui" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="$(QtMsBuild)\qt.targets" Condition="Exists('$(QtMsBuild)\qt.targets')" />
<ImportGroup Label="ExtensionTargets" />
</Project>

View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="BaseTool">
<UniqueIdentifier>{bf5c3550-65f6-4dad-9908-26690551ffad}</UniqueIdentifier>
</Filter>
<Filter Include="ToolAbstract">
<UniqueIdentifier>{4233f4e2-0d0f-4cf9-8722-367d80339b2c}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="BaseTool\BaseConstVariable.h">
<Filter>BaseTool</Filter>
</ClInclude>
<ClInclude Include="BaseTool\BaseTool.h">
<Filter>BaseTool</Filter>
</ClInclude>
<ClInclude Include="BaseTool\EchoDataFormat.h">
<Filter>BaseTool</Filter>
</ClInclude>
<ClInclude Include="BaseTool\FileOperator.h">
<Filter>BaseTool</Filter>
</ClInclude>
<ClInclude Include="BaseTool\GeoOperator.h">
<Filter>BaseTool</Filter>
</ClInclude>
<ClInclude Include="BaseTool\ImageOperatorBase.h">
<Filter>BaseTool</Filter>
</ClInclude>
<ClInclude Include="BaseTool\LogInfoCls.h">
<Filter>BaseTool</Filter>
</ClInclude>
<ClInclude Include="BaseTool\RasterToolBase.h">
<Filter>BaseTool</Filter>
</ClInclude>
<ClInclude Include="BaseTool\SARSimulationImageL1.h">
<Filter>BaseTool</Filter>
</ClInclude>
<ClInclude Include="BaseTool\stdafx.h">
<Filter>BaseTool</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="pch.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="BaseTool\BaseTool.cpp">
<Filter>BaseTool</Filter>
</ClCompile>
<ClCompile Include="BaseTool\EchoDataFormat.cpp">
<Filter>BaseTool</Filter>
</ClCompile>
<ClCompile Include="BaseTool\FileOperator.cpp">
<Filter>BaseTool</Filter>
</ClCompile>
<ClCompile Include="BaseTool\GeoOperator.cpp">
<Filter>BaseTool</Filter>
</ClCompile>
<ClCompile Include="BaseTool\ImageOperatorBase.cpp">
<Filter>BaseTool</Filter>
</ClCompile>
<ClCompile Include="BaseTool\LogInfoCls.cpp">
<Filter>BaseTool</Filter>
</ClCompile>
<ClCompile Include="BaseTool\QToolProcessBarDialog.cpp">
<Filter>BaseTool</Filter>
</ClCompile>
<ClCompile Include="BaseTool\RasterToolBase.cpp">
<Filter>BaseTool</Filter>
</ClCompile>
<ClCompile Include="BaseTool\SARSimulationImageL1.cpp">
<Filter>BaseTool</Filter>
</ClCompile>
<ClCompile Include="BaseTool\stdafx.cpp">
<Filter>BaseTool</Filter>
</ClCompile>
<ClCompile Include="ToolAbstract\QToolAbstract.cpp">
<Filter>ToolAbstract</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="BaseTool\QToolProcessBarDialog.h">
<Filter>头文件</Filter>
</QtMoc>
<QtMoc Include="ToolAbstract\QToolAbstract.h">
<Filter>ToolAbstract</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<QtUic Include="BaseTool\QToolProcessBarDialog.ui" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,317 @@
#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 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 <mkl.h>
#include <complex>
#include <math.h>
#include <complex>
#include <time.h>
/** 打印时间 ***************************************************************/
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 earthRoute 0.000072292115
#define Memory1GB 1073741824
#define Memory1MB 1048576
#define Memory1KB 1024
const std::complex<double> 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
};
/*********************************************** 基础结构体区域 ********************************************************************/
/// <summary>
/// 地理坐标点
/// </summary>
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;
};
struct DemBox {
double min_lon;
double max_lon;
double min_lat;
double max_lat;
};
/*********************************************** FEKO仿真参数 ********************************************************************/
struct SatellitePos {
double time;
double Px;
double Py;
double Pz;
double Vx;
double Vy;
double Vz;
};
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
};
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;
};
/*********************************************** 卫星轨道坐标 ********************************************************************/
/// <summary>
/// 轨道节点,坐标系统为WGS84
/// </summary>
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)
{
delete[] p;
p = nullptr;
}
inline void delPointer(void* p)
{
delete p;
p = nullptr;
}
inline void PrintTime() {
time_t current_time;
time(&current_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;
}
#endif

View File

@ -0,0 +1,117 @@
#pragma once
#ifndef BASETOOL_H
#define BASETOOL_H
#include "BaseConstVariable.h"
///
/// 基本类、基本函数
///
// //#include <mkl.h>
#include <complex>
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <time.h>
#include <string>
#include <omp.h>
#include <gdal.h>
#include <gdal_priv.h>
#include <gdalwarper.h>
#include <ogrsf_frmts.h>
#include <fstream>
#include "GeoOperator.h"
#include <vector>
#include <string>
#include <QString>
#include <QStringList>
#include "LogInfoCls.h"
///////////////////////////////////// 运行时间打印
/////////////////////////////////////////////////////////////
QString BASECONSTVARIABLEAPI getCurrentTimeString();
QString BASECONSTVARIABLEAPI getCurrentShortTimeString();
std::vector<QString> BASECONSTVARIABLEAPI splitString(const QString& str, char delimiter);
std::vector<QString> BASECONSTVARIABLEAPI convertQStringListToStdVector(const QStringList& qStringList);
/////////////////////////////// 基本图像类 结束
/////////////////////////////////////////////////////////////
std::string BASECONSTVARIABLEAPI Convert(float Num);
QString BASECONSTVARIABLEAPI JoinPath(const QString& path, const QString& filename);
////////////////////////////// 坐标部分基本方法 //////////////////////////////////////////
////////////////////////////// 坐标部分基本方法 //////////////////////////////////////////
////////////////////////////// 插值 ////////////////////////////////////////////
std::complex<double> BASECONSTVARIABLEAPI Cubic_Convolution_interpolation(double u, double v,
Eigen::MatrixX<std::complex<double>> img);
std::complex<double> 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<double>& 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);
/// <summary>
/// list 应该是按照从小到大的顺序排好
/// </summary>
/// <param name="list"></param>
/// <param name="findv"></param>
/// <returns></returns>
long BASECONSTVARIABLEAPI FindValueInStdVector(std::vector<double>& list,double& findv);
long BASECONSTVARIABLEAPI InsertValueInStdVector(std::vector<double>& list, double insertValue, bool repeatValueInsert = false);
long BASECONSTVARIABLEAPI FindValueInStdVectorLast(std::vector<double>& list, double& findv);
ErrorCode BASECONSTVARIABLEAPI polynomial_fit(const std::vector<double>& x, const std::vector<double>& y, int degree, std::vector<double>& out_factor, double& out_chisq);
QVector<SatelliteAntPos> BASECONSTVARIABLEAPI SatellitePos2SatelliteAntPos(QVector<SatellitePos> poses);
QVector<SatellitePos> BASECONSTVARIABLEAPI SatelliteAntPos2SatellitePos(QVector<SatelliteAntPos> poses);
QString BASECONSTVARIABLEAPI getDebugDataPath(QString filename);
std::vector<std::string> BASECONSTVARIABLEAPI split(const std::string& str, char delimiter);
Eigen::VectorXd BASECONSTVARIABLEAPI linspace(double start, double stop, int num);
#endif

View File

@ -145,9 +145,10 @@ ErrorCode EchoL0Dataset::OpenOrNew(QString folder, QString filename, long PluseC
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI");
std::shared_ptr<GDALDataset> poDstDS(poDriver->Create(this->GPSPointFilePath.toUtf8().constData(), 19, PluseCount, 1, GDT_Float64, NULL));
GDALFlushCache((GDALDatasetH)poDstDS.get());
poDstDS.reset();
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); //
@ -163,9 +164,10 @@ ErrorCode EchoL0Dataset::OpenOrNew(QString folder, QString filename, long PluseC
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI");
std::shared_ptr<GDALDataset> poDstDS(poDriver->Create(this->echoDataFilePath.toUtf8().constData(), PlusePoints, PluseCount, 1, GDT_CFloat64, NULL));
GDALFlushCache((GDALDatasetH)poDstDS.get());
poDstDS.reset();
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); //
@ -251,7 +253,7 @@ QString EchoL0Dataset::getEchoDataFilename()
void EchoL0Dataset::initEchoArr(std::complex<double> init0)
{
long blockline = Memory1MB * 2000 / 8 / 2 / this->PlusePoints;
long blockline = Memory1MB / 8 / 2 / this->PlusePoints * 8000;
long start = 0;
for (start = 0; start < this->PluseCount; start = start + blockline) {
@ -310,6 +312,16 @@ 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<double> antpos = this->getAntPos();
@ -336,6 +348,16 @@ SatelliteAntPos EchoL0Dataset::getSatelliteAntPos(long prf_id)
return prfpos;
}
void EchoL0Dataset::setRefPhaseRange(double refRange)
{
this->refPhaseRange = refRange;
}
double EchoL0Dataset::setRefPhaseRange()
{
return this->refPhaseRange;
}
// 打印信息的实现
void EchoL0Dataset::printInfo() {
std::cout << "Simulation Task Name: " << this->simulationTaskName.toStdString() << std::endl;
@ -345,6 +367,7 @@ void EchoL0Dataset::printInfo() {
std::cout << "Far Range: " << this->FarRange << std::endl;
std::cout << "Center Frequency: " << this->centerFreq << std::endl;
std::cout << "Sampling Frequency: " << this->Fs << std::endl;
std::cout << "Band width: " << this->bandwidth << std::endl;
}
// xml文件读写
@ -364,6 +387,7 @@ void EchoL0Dataset::saveToXml() {
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));
@ -376,6 +400,7 @@ void EchoL0Dataset::saveToXml() {
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();
@ -406,7 +431,11 @@ ErrorCode EchoL0Dataset::loadFromXml() {
if (xmlReader.isStartElement()) {
QString elementName = xmlReader.name().toString();
if (elementName == "PluseCount") {
if (elementName == "BandWidth") {
this->bandwidth = xmlReader.readElementText().toLong();
PluseCountflag = true;
}
else if (elementName == "PluseCount") {
this->PluseCount = xmlReader.readElementText().toLong();
PluseCountflag = true;
}
@ -430,6 +459,10 @@ ErrorCode EchoL0Dataset::loadFromXml() {
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();
}
@ -594,7 +627,11 @@ ErrorCode EchoL0Dataset::saveEchoArr(std::shared_ptr<std::complex<double>> echoP
omp_lock_t lock;
omp_init_lock(&lock);
omp_set_lock(&lock);
std::shared_ptr<GDALDataset> rasterDataset = OpenDataset(this->echoDataFilePath, GDALAccess::GA_Update);
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();
@ -620,13 +657,14 @@ ErrorCode EchoL0Dataset::saveEchoArr(std::shared_ptr<std::complex<double>> echoP
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.get());
GDALFlushCache((GDALDatasetH)rasterDataset);
}
else {
qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR));
}
}
rasterDataset.reset();
GDALClose(rasterDataset);
rasterDataset = nullptr;
omp_unset_lock(&lock); //
omp_destroy_lock(&lock); //
return ErrorCode::SUCCESS;

View File

@ -69,10 +69,10 @@ struct PluseData {
std::shared_ptr<std::complex<double>> echoData; // 回波数据
};
long getPluseDataSize(PluseData& pluseData);
ErrorCode getPluseDataFromBuffer(char* buffer, PluseData& data);
std::shared_ptr<PluseData> CreatePluseDataArr(long pluseCount);
std::shared_ptr<std::complex<double>> CreateEchoData(long plusePoints);
long BASECONSTVARIABLEAPI getPluseDataSize(PluseData& pluseData);
ErrorCode BASECONSTVARIABLEAPI getPluseDataFromBuffer(char* buffer, PluseData& data);
std::shared_ptr<PluseData> BASECONSTVARIABLEAPI CreatePluseDataArr(long pluseCount);
std::shared_ptr<std::complex<double>> BASECONSTVARIABLEAPI CreateEchoData(long plusePoints);
@ -89,11 +89,11 @@ struct PluseAntPos {
double Vy;
double Vz;
};
std::shared_ptr<PluseAntPos> CreatePluseAntPosArr(long pluseCount);
std::shared_ptr<PluseAntPos> BASECONSTVARIABLEAPI CreatePluseAntPosArr(long pluseCount);
// 定义L0级数据
class EchoL0Dataset {
class BASECONSTVARIABLEAPI EchoL0Dataset {
public:
EchoL0Dataset();
@ -153,7 +153,13 @@ public: //
QString getLookSide();
void setLookSide(QString lookside);
double getBandwidth();
void setBandwidth(double Inbandwidth);
SatelliteAntPos getSatelliteAntPos(long plusePRFID);
void setRefPhaseRange(double refRange);
double setRefPhaseRange();
// 打印信息的成员函数
void printInfo() ;
@ -168,6 +174,8 @@ private: //
double CenterAngle;
QString LookSide;
double refPhaseRange;
double bandwidth;
public: // 读写 XML 的函数
void saveToXml();
@ -182,10 +190,6 @@ public:
ErrorCode saveAntPos(std::shared_ptr<double> ptr); // 注意这个方法很危险,请写入前检查数据是否正确
ErrorCode saveEchoArr(std::shared_ptr<std::complex<double>> echoPtr, long startPRF, long PRFLen);
};

View File

@ -0,0 +1,56 @@
#pragma once
#ifndef FILEOPERATOR_H
#define FILEOPERATOR_H
#include "BaseConstVariable.h"
#include <string.h>
#include <memory.h>
#include <memory>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
#include <QString>
#include <QDir>
#include <QFile>
#include <QDebug>
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);
/// <summary>
/// 获取文件(绝对路径)
/// </summary>
/// <param name="folderpath"></param>
/// <param name="FilenameExtension"></param>
/// <returns></returns>
std::vector<QString> 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);
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

View File

@ -0,0 +1,126 @@
#pragma once
#ifndef _GEOOPERATOR_H
#define _GEOOPERATOR_H
#include "BaseConstVariable.h"
#include <Eigen/Core>
#include <Eigen/Dense>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <iostream>
/// <summary>
/// 将经纬度转换为地固参心坐标系
/// </summary>
/// <param name="XYZP">经纬度点--degree</param>
/// <returns>投影坐标系点</returns>
Landpoint BASECONSTVARIABLEAPI LLA2XYZ(const Landpoint& LLA);
void BASECONSTVARIABLEAPI LLA2XYZ(const Landpoint& LLA,Point3& XYZ);
Eigen::MatrixXd BASECONSTVARIABLEAPI LLA2XYZ(Eigen::MatrixXd landpoint);
/// <summary>
/// 将地固参心坐标系转换为经纬度
/// </summary>
/// <param name="XYZ">固参心坐标系</param>
/// <returns>经纬度--degree</returns>
Landpoint BASECONSTVARIABLEAPI XYZ2LLA(const Landpoint& XYZ);
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);
/// <summary>
/// n1
/// n4 n0 n2
/// n3
/// </summary>
/// <param name="n0"></param>
/// <param name="n1"></param>
/// <param name="n2"></param>
/// <param name="n3"></param>
/// <param name="n4"></param>
/// <returns></returns>
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);
#endif

View File

@ -29,7 +29,6 @@
#include <ogr_spatialref.h> // OGRSpatialReference 用于空间参考转换
#include <gdal_alg.h> // 用于 GDALWarp 操作
#include "../Imageshow/ImageShowDialogClass.h"
/**
@ -290,7 +289,7 @@ ReadComplexMatrixData(int start_line, int width, int line_num,
data_mat.col(1) = (complex_short_mat.imag().array().cast<double>()).array();
_flag = true;
} else if(gdal_datatype == GDT_CFloat32) {
Eigen::MatrixX<std::complex<float>> complex_short_mat(line_num * width, 1);
Eigen::MatrixX<std::complex<double>> 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
@ -757,6 +756,64 @@ Eigen::MatrixXi gdalImage::getDatai(int start_row, int start_col, int rows_count
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;
@ -821,21 +878,32 @@ void gdalImage::saveImage(Eigen::MatrixXd data, int start_row = 0, int start_col
int datarows = data.rows();
int datacols = data.cols();
float* databuffer =
new float[datarows * datacols]; // (float*)malloc(datarows * datacols * sizeof(float));
for(int i = 0; i < datarows; i++) {
for(int j = 0; j < datacols; j++) {
float temp = float(data(i, j));
databuffer[i * datacols + j] = temp;
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->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);
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
@ -1171,6 +1239,53 @@ RasterExtend gdalImage::getExtend()
return extend;
}
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)
{
@ -1609,6 +1724,31 @@ int saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path)
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 MergeRasterProcess(QVector<QString> filepaths, QString outfileptah, QString mainString, MERGEMODE mergecode, bool isENVI, ShowProessAbstract* dia )
{
@ -1945,7 +2085,7 @@ bool saveEigenMatrixXd2Bin(Eigen::MatrixXd data, QString dataStrPath)
Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3);
gdalImage img=CreategdalImage(dataStrPath, data.rows(), data.cols(), 1, gt, "", false, false,true);
gdalImage img= CreategdalImageDouble(dataStrPath, data.rows(), data.cols(), 1, gt, "", false, true,true);
img.saveImage(data, 0,0,1);
@ -2808,3 +2948,89 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri
return ErrorCode::SUCCESS;
}
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);
std::cout << filename.toLocal8Bit().constData() << std::endl;
std::cout << "max:\t" << h_amp_img.maxCoeff() << std::endl;
std::cout << "min:\t" << h_amp_img.minCoeff() << std::endl;
}
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);
std::cout << filename.toLocal8Bit().constData() << std::endl;
std::cout << "max:\t" << h_amp_img.maxCoeff() << std::endl;
std::cout << "min:\t" << h_amp_img.minCoeff() << std::endl;
}
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);
std::cout << filename.toLocal8Bit().constData() << std::endl;
std::cout << "max:\t" << h_amp_img.maxCoeff() << std::endl;
std::cout << "min:\t" << h_amp_img.minCoeff() << std::endl;
}
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<double>(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);
}

View File

@ -74,7 +74,7 @@ enum GDALREADARRCOPYMETHOD {
class ShowProessAbstract{
class BASECONSTVARIABLEAPI ShowProessAbstract{
public:
virtual void showProcess(double precent,QString tip);
@ -91,49 +91,49 @@ public:
/// \param long 经度
/// \param lat 纬度
/// \return 对应投影坐标系统的 EPSG编码,-1 表示计算错误
long getProjectEPSGCodeByLon_Lat(double long, double lat,ProjectStripDelta stripState );
long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double long, double lat,ProjectStripDelta stripState );
long getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat);
long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat);
long getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat);
long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat);
QString GetProjectionNameFromEPSG(long epsgCode);
QString BASECONSTVARIABLEAPI GetProjectionNameFromEPSG(long epsgCode);
long GetEPSGFromRasterFile(QString filepath);
long BASECONSTVARIABLEAPI GetEPSGFromRasterFile(QString filepath);
std::shared_ptr<PointRaster> GetCenterPointInRaster(QString filepath);
std::shared_ptr<PointRaster> BASECONSTVARIABLEAPI GetCenterPointInRaster(QString filepath);
CoordinateSystemType getCoordinateSystemTypeByEPSGCode(long EPSGCODE);
CoordinateSystemType BASECONSTVARIABLEAPI getCoordinateSystemTypeByEPSGCode(long EPSGCODE);
// 文件打开 // 当指令销毁时调用GDALClose 销毁类型
std::shared_ptr<GDALDataset> OpenDataset(const QString& in_path, GDALAccess rwmode= GA_ReadOnly);
void CloseDataset(GDALDataset* ptr);
std::shared_ptr<GDALDataset> BASECONSTVARIABLEAPI OpenDataset(const QString& in_path, GDALAccess rwmode= GA_ReadOnly);
void BASECONSTVARIABLEAPI CloseDataset(GDALDataset* ptr);
// 数据格式转换
int TIFF2ENVI(QString in_tiff_path,QString out_envi_path);
int ENVI2TIFF(QString in_envi_path,QString out_tiff_path);
int BASECONSTVARIABLEAPI TIFF2ENVI(QString in_tiff_path,QString out_envi_path);
int BASECONSTVARIABLEAPI ENVI2TIFF(QString in_envi_path,QString out_tiff_path);
// 保存影像数据 --直接保存 ENVI 文件
int CreateDataset(QString new_file_path, int height, int width, int band_num, double* gt, QString projection, GDALDataType gdal_dtype, bool need_gt); // 创建文件
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 saveDataset(QString new_file_path, int start_line, int start_cols, int band_ids, int datacols, int datarows, void* databuffer);
int BASECONSTVARIABLEAPI saveDataset(QString new_file_path, int start_line, int start_cols, int band_ids, int datacols, int datarows, void* databuffer);
// 根据限制条件估算分块大小
int block_num_pre_memory(int width, int height, GDALDataType gdal_dtype,double memey_size);
int BASECONSTVARIABLEAPI block_num_pre_memory(int width, int height, GDALDataType gdal_dtype,double memey_size);
// 将结果转换为复数 或者 实数
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> ReadComplexMatrixData(int start_line,int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype);
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> BASECONSTVARIABLEAPI ReadComplexMatrixData(int start_line,int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype);
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> ReadMatrixDoubleData(int start_line, int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype,int band_idx);
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> BASECONSTVARIABLEAPI ReadMatrixDoubleData(int start_line, int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype,int band_idx);
Eigen::MatrixXd getGeoTranslationArray(QString in_path);
ImageGEOINFO getImageINFO(QString in_path);
Eigen::MatrixXd BASECONSTVARIABLEAPI getGeoTranslationArray(QString in_path);
ImageGEOINFO BASECONSTVARIABLEAPI getImageINFO(QString in_path);
GDALDataType getGDALDataType(QString fileptah);
GDALDataType BASECONSTVARIABLEAPI getGDALDataType(QString fileptah);
struct RasterExtend {
@ -151,7 +151,7 @@ struct RasterExtend {
/// gdalImage图像操作类
/// </summary>
class gdalImage
class BASECONSTVARIABLEAPI gdalImage
{
public: // 方法
@ -164,7 +164,8 @@ public: // 方法
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::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);
@ -209,7 +210,7 @@ public:
/// <summary>
/// gdalImage图像操作类
/// </summary>
class gdalImageComplex:public gdalImage
class BASECONSTVARIABLEAPI gdalImageComplex:public gdalImage
{
public: // 方法
@ -226,35 +227,42 @@ public:
};
// 创建影像
gdalImage 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);
gdalImage 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);
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);
gdalImageComplex CreategdalImageComplex(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt = true, bool overwrite = false);
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 CreateEchoComplex(const QString& img_path, int height, int width, int band_num);
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);
ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QString demsloperPath);
gdalImageComplex BASECONSTVARIABLEAPI CreateEchoComplex(const QString& img_path, int height, int width, int band_num);
int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int new_width, int new_height, GDALResampleAlg eResample);
ErrorCode BASECONSTVARIABLEAPI DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QString demsloperPath);
void resampleRaster(const char* inputRaster, const char* outputRaster, double targetPixelSizeX, double targetPixelSizeY);
int BASECONSTVARIABLEAPI ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int new_width, int new_height, GDALResampleAlg eResample);
void cropRasterByLatLon(const char* inputFile, const char* outputFile, double minLon, double maxLon, double minLat, double maxLat);
void BASECONSTVARIABLEAPI resampleRaster(const char* inputRaster, const char* outputRaster, double targetPixelSizeX, double targetPixelSizeY);
int ResampleGDALs(const char* pszSrcFile, int band_ids, GDALRIOResampleAlg eResample = GRIORA_Bilinear);
void BASECONSTVARIABLEAPI cropRasterByLatLon(const char* inputFile, const char* outputFile, double minLon, double maxLon, double minLat, double maxLat);
void transformRaster(const char* inputFile, const char* outputFile, int sourceEPSG, int targetEPSG);
int BASECONSTVARIABLEAPI ResampleGDALs(const char* pszSrcFile, int band_ids, GDALRIOResampleAlg eResample = GRIORA_Bilinear);
ErrorCode transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG, Point2& p);
void BASECONSTVARIABLEAPI transformRaster(const char* inputFile, const char* outputFile, int sourceEPSG, int targetEPSG);
int alignRaster(QString inputPath, QString referencePath, QString outputPath, GDALResampleAlg eResample);
ErrorCode BASECONSTVARIABLEAPI transformCoordinate(double x, double y, int sourceEPSG, int targetEPSG, Point2& p);
int BASECONSTVARIABLEAPI alignRaster(QString inputPath, QString referencePath, QString outputPath, GDALResampleAlg eResample);
//--------------------- 保存文博 -------------------------------
int saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path);
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);
//--------------------- 图像合并流程 ------------------------------
enum MERGEMODE
{
@ -262,19 +270,30 @@ enum MERGEMODE
};
ErrorCode MergeRasterProcess(QVector<QString> filepath, QString outfileptah, QString mainString, MERGEMODE mergecode = MERGEMODE::MERGE_GEOCODING, bool isENVI = false, ShowProessAbstract* dia=nullptr);
ErrorCode BASECONSTVARIABLEAPI MergeRasterProcess(QVector<QString> filepath, QString outfileptah, QString mainString, MERGEMODE mergecode = MERGEMODE::MERGE_GEOCODING, bool isENVI = false, ShowProessAbstract* dia=nullptr);
ErrorCode MergeRasterInGeoCoding(QVector<gdalImage> inimgs, gdalImage resultimg,gdalImage maskimg, ShowProessAbstract* dia = nullptr);
ErrorCode BASECONSTVARIABLEAPI MergeRasterInGeoCoding(QVector<gdalImage> inimgs, gdalImage resultimg,gdalImage maskimg, ShowProessAbstract* dia = nullptr);
// 保存矩阵转换为envi文件默认数据格式为double
bool saveEigenMatrixXd2Bin(Eigen::MatrixXd data, QString dataStrPath);
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);
//--------------------- 图像文件读写 ------------------------------
template<typename T>
std::shared_ptr<T> readDataArr(gdalImage& imgds, int start_row, int start_col, int rows_count, int cols_count, int band_ids, GDALREADARRCOPYMETHOD method)
inline std::shared_ptr<T> readDataArr(gdalImage& imgds, int start_row, int start_col, int rows_count, int cols_count, int band_ids, GDALREADARRCOPYMETHOD method)
{
std::shared_ptr<T> result = nullptr;
@ -420,7 +439,7 @@ std::shared_ptr<T> readDataArr(gdalImage& imgds, int start_row, int start_col, i
delete[] temp;
}
//else if (gdal_datatype == GDT_CFloat32) {
// if (std::is_same<T, std::complex<double>>::value || std::is_same<T, std::complex<float>>::value) {
// if (std::is_same<T, std::complex<double>>::value || std::is_same<T, std::complex<double>>::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);
@ -442,7 +461,7 @@ std::shared_ptr<T> readDataArr(gdalImage& imgds, int start_row, int start_col, i
// }
//}
//else if (gdal_datatype == GDT_CFloat64 ) {
// if (std::is_same<T, std::complex<double>>::value || std::is_same<T, std::complex<float>>::value) {
// if (std::is_same<T, std::complex<double>>::value || std::is_same<T, std::complex<double>>::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);
@ -473,7 +492,7 @@ std::shared_ptr<T> readDataArr(gdalImage& imgds, int start_row, int start_col, i
}
template<typename T>
std::shared_ptr<T> readDataArrComplex(gdalImageComplex& imgds, int start_row, int start_col, int rows_count, int cols_count, int band_ids, GDALREADARRCOPYMETHOD method)
inline std::shared_ptr<T> readDataArrComplex(gdalImageComplex& imgds, int start_row, int start_col, int rows_count, int cols_count, int band_ids, GDALREADARRCOPYMETHOD method)
{
std::shared_ptr<T> result = nullptr;
@ -493,7 +512,7 @@ std::shared_ptr<T> readDataArrComplex(gdalImageComplex& imgds, int start_row, in
//Eigen::MatrixXd datamatrix(rows_count, cols_count);
if (gdal_datatype == GDT_CFloat32) {
if (std::is_same<T, std::complex<double>>::value || std::is_same<T, std::complex<float>>::value) {
if (std::is_same<T, std::complex<double>>::value || std::is_same<T, std::complex<double>>::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);
@ -515,7 +534,7 @@ std::shared_ptr<T> readDataArrComplex(gdalImageComplex& imgds, int start_row, in
}
}
else if (gdal_datatype == GDT_CFloat64) {
if (std::is_same<T, std::complex<double>>::value || std::is_same<T, std::complex<float>>::value) {
if (std::is_same<T, std::complex<double>>::value || std::is_same<T, std::complex<double>>::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);

View File

@ -58,8 +58,8 @@ std::string errorCode2errInfo(ErrorCode e)
_CASE_STR(Error_GSL_ETOLX );
_CASE_STR(Error_GSL_ETOLG );
_CASE_STR(Error_GSL_EOF );
// RTPC
_CASE_STR(RTPC_PARAMSISEMPTY);
// RFPC
_CASE_STR(RFPC_PARAMSISEMPTY);
_CASE_STR(ECHO_L0DATA_NOTOPEN);
_CASE_STR(ECHO_L0DATA_ROW_COL_NOEQUAL);
_CASE_STR(ECHO_L0DATA_PRFIDXOUTRANGE);

View File

@ -6,7 +6,7 @@
* \author
* \date October 2024
*********************************************************************/
#include "BaseConstVariable.h"
#include <string>
// 定义变换
@ -68,8 +68,8 @@ enum ErrorCode {
Error_GSL_ETOLG = 131, /* cannot reach the specified tolerance in gradient */
Error_GSL_EOF = 132, /* end of file */
// RTPC
RTPC_PARAMSISEMPTY = 201,
// RFPC
RFPC_PARAMSISEMPTY = 201,
// L0 数据
ECHO_L0DATA_NOTOPEN = 202,
ECHO_L0DATA_ROW_COL_NOEQUAL = 203, // 行或者列数量错误
@ -93,10 +93,10 @@ enum ErrorCode {
std::string errorCode2errInfo(ErrorCode code);
std::string BASECONSTVARIABLEAPI errorCode2errInfo(ErrorCode code);
ErrorCode GSLState2ErrorCode(int gslState);
ErrorCode BASECONSTVARIABLEAPI GSLState2ErrorCode(int gslState);

View File

@ -1,11 +1,11 @@
#include "QToolProcessBarDialog.h"
#include "ui_QToolProcessBarDialog.h"
QToolProcessBarDialog::QToolProcessBarDialog(QWidget *parent)
: QDialog(parent)
: ui(new Ui::QToolProcessBarDialogClass), QDialog(parent)
{
ui.setupUi(this);
ui.progressBar->setRange(0, 100);
ui->setupUi(this);
ui->progressBar->setRange(0, 100);
}
QToolProcessBarDialog::~QToolProcessBarDialog()
@ -13,12 +13,12 @@ QToolProcessBarDialog::~QToolProcessBarDialog()
void QToolProcessBarDialog::showProcess(double precent, QString tip)
{
ui.progressBar->setValue(std::ceil(precent * 100));
ui.labelTip->setText(tip);
ui->progressBar->setValue(std::ceil(precent * 100));
ui->labelTip->setText(tip);
this->update();
}
void QToolProcessBarDialog::showToolInfo(QString tip)
{
ui.textEditTip->append("\n"+tip);
ui->textEditTip->append("\n"+tip);
}

View File

@ -1,9 +1,14 @@
#pragma once
#include "BaseConstVariable.h"
#include <QDialog>
#include "ui_QToolProcessBarDialog.h"
#include "ImageOperatorBase.h"
class QToolProcessBarDialog : public QDialog, public ShowProessAbstract
namespace Ui {
class QToolProcessBarDialogClass;
}
class BASECONSTVARIABLEAPI QToolProcessBarDialog : public QDialog, public ShowProessAbstract
{
Q_OBJECT
public:
@ -11,8 +16,7 @@ public:
~QToolProcessBarDialog();
private:
Ui::QToolProcessBarDialogClass ui;
Ui::QToolProcessBarDialogClass* ui;
public:
virtual void showProcess(double precent, QString tip) override;
virtual void showToolInfo(QString tip) override;

View File

@ -9,6 +9,7 @@
#ifndef LAMPCAE_RASTERTOOLBASE_H
#define LAMPCAE_RASTERTOOLBASE_H
#include "BaseConstVariable.h"
#include "gdal_priv.h"
#include <memory>
@ -54,22 +55,22 @@ namespace RasterToolBase {
/// \param long 经度
/// \param lat 纬度
/// \return 对应投影坐标系统的 EPSG编码,-1 表示计算错误
long getProjectEPSGCodeByLon_Lat(double long, double lat,
long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat(double long, double lat,
ProjectStripDelta stripState = ProjectStripDelta::Strip_3);
long getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat);
long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip3(double lon, double lat);
long getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat);
long BASECONSTVARIABLEAPI getProjectEPSGCodeByLon_Lat_inStrip6(double lon, double lat);
QString GetProjectionNameFromEPSG(long epsgCode) ;
QString BASECONSTVARIABLEAPI GetProjectionNameFromEPSG(long epsgCode) ;
long GetEPSGFromRasterFile(QString filepath);
long BASECONSTVARIABLEAPI GetEPSGFromRasterFile(QString filepath);
std::shared_ptr<PointRaster> GetCenterPointInRaster(QString filepath);
std::shared_ptr<PointRaster> BASECONSTVARIABLEAPI GetCenterPointInRaster(QString filepath);
CoordinateSystemType getCoordinateSystemTypeByEPSGCode(long EPSGCODE);
CoordinateSystemType BASECONSTVARIABLEAPI getCoordinateSystemTypeByEPSGCode(long EPSGCODE);

View File

@ -132,7 +132,7 @@ ErrorCode SARSimulationImageL1Dataset::OpenOrNew(QString folder, QString filenam
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI");
std::shared_ptr<GDALDataset> poDstDS(poDriver->Create(this->ImageRasterPath.toUtf8().constData(), colCount, rowCount, 1, GDT_CFloat64, NULL));
std::shared_ptr<GDALDataset> poDstDS(poDriver->Create(this->ImageRasterPath.toUtf8().constData(), colCount, rowCount, 1, GDT_CFloat32, NULL));
GDALFlushCache((GDALDatasetH)poDstDS.get());
poDstDS.reset();
omp_unset_lock(&lock); //
@ -649,8 +649,8 @@ ErrorCode SARSimulationImageL1Dataset::saveImageRaster(std::shared_ptr<std::comp
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);
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 {
@ -700,9 +700,9 @@ std::shared_ptr<std::complex<double>> SARSimulationImageL1Dataset::getImageRaste
qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR));
}
else {
if (gdal_datatype == GDT_CFloat64) {
if (gdal_datatype == GDT_CFloat32) {
temp = std::shared_ptr<std::complex<double>>(new std::complex<double>[PRFLen * width], delArrPtr);
poBand->RasterIO(GF_Read, 0, startPRF, width, PRFLen, temp.get(), width, PRFLen, GDT_CFloat64, 0, 0);
poBand->RasterIO(GF_Read, 0, startPRF, width, PRFLen, temp.get(), width, PRFLen, GDT_CFloat32, 0, 0);
GDALFlushCache((GDALDatasetH)rasterDataset.get());
}
else {

View File

@ -14,7 +14,7 @@ enum RasterLevel {
RasterL2
};
class SARSimulationImageL1Dataset
class BASECONSTVARIABLEAPI SARSimulationImageL1Dataset
{
public:
SARSimulationImageL1Dataset(RasterLevel Rasterlevel= RasterLevel::RasterSLC);

View File

@ -1,5 +1,8 @@
#pragma once
#ifndef QToolAbstract_H_
#define QToolAbstract_H_
#include "BaseConstVariable.h"
#include <QTreeWidgetItem>
#include <QPushButton>
#include <QMessageBox>
@ -10,7 +13,7 @@
// ×Ô¶¨Òå QTreeWidgetItem ¼Ì³ÐÀà
class QToolAbstract : public QObject {
class BASECONSTVARIABLEAPI QToolAbstract : public QObject {
Q_OBJECT
public:
QToolAbstract(QObject* parent=nullptr);
@ -24,5 +27,12 @@ public slots:
public:
QVector<QString> toolPath;
QString toolname;
};
/*
// ×¢²á¹¤¾ßÏä
PluginTool_*.dll
void RegisterPreToolBox(RasterProcessTool* mainWindows);
extern "C" void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows,ToolBoxWidget* toolbox);
*/
#endif // !1

View File

@ -0,0 +1,19 @@
// 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;
}

View File

@ -0,0 +1,5 @@
#pragma once
#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
// Windows 头文件
#include <windows.h>

View File

@ -0,0 +1,5 @@
// pch.cpp: 与预编译标头对应的源文件
#include "pch.h"
// 当使用预编译的头时,需要使用此源文件,编译才能成功。

13
BaseCommonLibrary/pch.h Normal file
View File

@ -0,0 +1,13 @@
// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
#ifndef PCH_H
#define PCH_H
// 添加要在此处预编译的标头
#include "framework.h"
#endif //PCH_H

@ -1 +0,0 @@
Subproject commit 798e02352fba7bd4ed6f36f920a14553605522f7

View File

@ -1,163 +0,0 @@
#pragma once
#ifndef BASECONSTVARIABLE_H
#define BASECONSTVARIABLE_H
#define EIGEN_USE_MKL_ALL
//#define EIGEN_NO_DEBUG
#define EIGEN_USE_BLAS
#define EIGEN_USE_LAPACK
#define EIGEN_VECTORIZE_SSE2
//#define DEBUGSHOWDIALOG
#define __CUDANVCC___ // 定义CUDA函数
//#define __PRFDEBUG__
//#include <mkl.h>
#include <complex>
#include <math.h>
#include <complex>
#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 earthRoute 0.000072292115
#define Memory1GB 1073741824
#define Memory1MB 1048576
#define Memory1KB 1024
const std::complex<double> 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
};
/*********************************************** 基础结构体区域 ********************************************************************/
/// <summary>
/// 地理坐标点
/// </summary>
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;
};
struct DemBox {
double min_lon;
double max_lon;
double min_lat;
double max_lat;
};
/*********************************************** FEKO仿真参数 ********************************************************************/
struct SatellitePos {
double time;
double Px;
double Py;
double Pz;
double Vx;
double Vy;
double Vz;
};
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
};
/*********************************************** 指针回收区域 ********************************************************************/
inline void delArrPtr(void* p)
{
delete[] p;
p = nullptr;
}
inline void delPointer(void* p)
{
delete p;
p = nullptr;
}
#endif

View File

@ -1,117 +0,0 @@
#pragma once
#ifndef BASETOOL_H
#define BASETOOL_H
#include "BaseConstVariable.h"
///
/// 基本类、基本函数
///
// //#include <mkl.h>
#include <complex>
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <time.h>
#include <string>
#include <omp.h>
#include <gdal.h>
#include <gdal_priv.h>
#include <gdalwarper.h>
#include <ogrsf_frmts.h>
#include <fstream>
#include "GeoOperator.h"
#include <vector>
#include <string>
#include <QString>
#include <QStringList>
#include "LogInfoCls.h"
///////////////////////////////////// 运行时间打印
/////////////////////////////////////////////////////////////
QString getCurrentTimeString();
QString getCurrentShortTimeString();
std::vector<QString> splitString(const QString& str, char delimiter);
std::vector<QString> convertQStringListToStdVector(const QStringList& qStringList);
/////////////////////////////// 基本图像类 结束
/////////////////////////////////////////////////////////////
std::string Convert(float Num);
QString JoinPath(const QString& path, const QString& filename);
////////////////////////////// 坐标部分基本方法 //////////////////////////////////////////
////////////////////////////// 坐标部分基本方法 //////////////////////////////////////////
////////////////////////////// 插值 ////////////////////////////////////////////
std::complex<double> Cubic_Convolution_interpolation(double u, double v,
Eigen::MatrixX<std::complex<double>> img);
std::complex<double> Cubic_kernel_weight(double s);
double Bilinear_interpolation(Landpoint p0, Landpoint p11, Landpoint p21, Landpoint p12,Landpoint p22);
bool onSegment(Point3 Pi, Point3 Pj, Point3 Q);
Point3 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 sind(double degree);
double cosd(double d);
// 插值
ErrorCode polyfit(const double* x, const double* y, int xyLength, int poly_n, std::vector<double>& out_factor, double& out_chisq);
// 叉乘
Point3 crossProduct(const Point3& a, const Point3& b);
Eigen::Matrix3d rotationMatrix(const Eigen::Vector3d& axis, double angle);
long double convertToMilliseconds(const std::string& dateTimeStr);
/// <summary>
/// list 应该是按照从小到大的顺序排好
/// </summary>
/// <param name="list"></param>
/// <param name="findv"></param>
/// <returns></returns>
long FindValueInStdVector(std::vector<double>& list,double& findv);
long InsertValueInStdVector(std::vector<double>& list, double insertValue, bool repeatValueInsert = false);
long FindValueInStdVectorLast(std::vector<double>& list, double& findv);
ErrorCode polynomial_fit(const std::vector<double>& x, const std::vector<double>& y, int degree, std::vector<double>& out_factor, double& out_chisq);
QVector<SatelliteAntPos> SatellitePos2SatelliteAntPos(QVector<SatellitePos> poses);
QVector<SatellitePos> SatelliteAntPos2SatellitePos(QVector<SatelliteAntPos> poses);
QString getDebugDataPath(QString filename);
std::vector<std::string> split(const std::string& str, char delimiter);
Eigen::VectorXd linspace(double start, double stop, int num);
#endif

View File

@ -1,56 +0,0 @@
#pragma once
#ifndef FILEOPERATOR_H
#define FILEOPERATOR_H
#include "BaseConstVariable.h"
#include <string.h>
#include <memory.h>
#include <memory>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
#include <QString>
#include <QDir>
#include <QFile>
#include <QDebug>
bool isDirectory(const QString& path);
bool isExists(const QString& path);
bool isFile(const QString& path);
void removeFile(const QString& filePath);
unsigned long convertToULong(const QString& input);
/// <summary>
/// 获取文件(绝对路径)
/// </summary>
/// <param name="folderpath"></param>
/// <param name="FilenameExtension"></param>
/// <returns></returns>
std::vector<QString> getFilelist(const QString& folderpath, const QString& FilenameExtension = ".*",int (*logfun)(QString logtext,int value)=nullptr);
QString getParantFolderNameFromPath(const QString& path);
QString getFileNameFromPath(const QString& path);
QString getFileNameWidthoutExtend(QString path);
int write_binfile(char* filepath, char* data, size_t data_len);
char* read_textfile(char* text_path, int* length);
bool exists_test(const QString& name);
size_t fsize(FILE* fp);
QString getParantFromPath(const QString& path);
void copyFile(const QString& sourcePath, const QString& destinationPath);
QString addMaskToFileName(const QString& filePath, QString _zzname);
// QT FileOperator
bool copyAndReplaceFile(const QString& sourceFilePath, const QString& destinationFilePath);
#endif

View File

@ -1,953 +0,0 @@
#include <iostream>
#include <memory>
#include <cmath>
#include <complex>
#include <device_launch_parameters.h>
#include <cuda_runtime.h>
#include <cublas_v2.h>
#include <cuComplex.h>
#include "BaseConstVariable.h"
#include "GPUTool.cuh"
#ifdef __CUDANVCC___
#define CUDAMEMORY Memory1MB*100
#define LAMP_CUDA_PI 3.141592653589793238462643383279
// 定义参数
__device__ cuComplex cuCexpf(cuComplex x)
{
float factor = exp(x.x);
return make_cuComplex(factor * cos(x.y), factor * sin(x.y));
}
// 定义仿真所需参数
__device__ float GPU_getSigma0dB(CUDASigmaParam param, float theta) {
float sigma= param.p1 + param.p2 * exp(-param.p3 * theta) + param.p4 * cos(param.p5 * theta + param.p6);
return sigma;
}
__device__ CUDAVector GPU_VectorAB(CUDAVector A, CUDAVector B) {
CUDAVector C;
C.x = B.x - A.x;
C.y = B.y - A.y;
C.z = B.z - A.z;
return C;
}
__device__ float GPU_VectorNorm2(CUDAVector A) {
return sqrtf(A.x * A.x + A.y * A.y + A.z * A.z);
}
__device__ float GPU_dotVector(CUDAVector A, CUDAVector B) {
return A.x * B.x + A.y * B.y + A.z * B.z;
}
__device__ float GPU_CosAngle_VectorA_VectorB(CUDAVector A, CUDAVector B) {
return GPU_dotVector(A, B) / (GPU_VectorNorm2(A) * GPU_VectorNorm2(B));
}
__device__ CUDAVectorEllipsoidal GPU_SatelliteAntDirectNormal(float RstX, float RstY, float RstZ,
float antXaxisX, float antXaxisY, float antXaxisZ,
float antYaxisX, float antYaxisY, float antYaxisZ,
float antZaxisX, float antZaxisY, float antZaxisZ,
float antDirectX, float antDirectY, float antDirectZ
) {
CUDAVectorEllipsoidal result{ 0,0,-1 };
float Xst = -1 * RstX; // 卫星 --> 地面
float Yst = -1 * RstY;
float Zst = -1 * RstZ;
float AntXaxisX = antXaxisX;
float AntXaxisY = antXaxisY;
float AntXaxisZ = antXaxisZ;
float AntYaxisX = antYaxisX;
float AntYaxisY = antYaxisY;
float AntYaxisZ = antYaxisZ;
float AntZaxisX = antZaxisX;
float AntZaxisY = antZaxisY;
float AntZaxisZ = antZaxisZ;
// 天线指向在天线坐标系下的值
float Xant = (Xst * (AntYaxisY * AntZaxisZ - AntYaxisZ * AntZaxisY) + Xst * (AntXaxisZ * AntZaxisY - AntXaxisY * AntZaxisZ) + Xst * (AntXaxisY * AntYaxisZ - AntXaxisZ * AntYaxisY)) / (AntXaxisX * (AntYaxisY * AntZaxisZ - AntZaxisY * AntYaxisZ) - AntYaxisX * (AntXaxisY * AntZaxisZ - AntXaxisZ * AntZaxisY) + AntZaxisX * (AntXaxisY * AntYaxisZ - AntXaxisZ * AntYaxisY));
float Yant = (Yst * (AntYaxisZ * AntZaxisX - AntYaxisX * AntZaxisZ) + Yst * (AntXaxisX * AntZaxisZ - AntXaxisZ * AntZaxisX) + Yst * (AntYaxisX * AntXaxisZ - AntXaxisX * AntYaxisZ)) / (AntXaxisX * (AntYaxisY * AntZaxisZ - AntZaxisY * AntYaxisZ) - AntYaxisX * (AntXaxisY * AntZaxisZ - AntXaxisZ * AntZaxisY) + AntZaxisX * (AntXaxisY * AntYaxisZ - AntXaxisZ * AntYaxisY));
float Zant = (Zst * (AntYaxisX * AntZaxisY - AntYaxisY * AntZaxisX) + Zst * (AntXaxisY * AntZaxisX - AntXaxisX * AntZaxisY) + Zst * (AntXaxisX * AntYaxisY - AntYaxisX * AntXaxisY)) / (AntXaxisX * (AntYaxisY * AntZaxisZ - AntZaxisY * AntYaxisZ) - AntYaxisX * (AntXaxisY * AntZaxisZ - AntXaxisZ * AntZaxisY) + AntZaxisX * (AntXaxisY * AntYaxisZ - AntXaxisZ * AntYaxisY));
// 计算theta 与 phi
float Norm = sqrtf(Xant * Xant + Yant * Yant + Zant * Zant); // 计算 pho
float ThetaAnt = acosf(Zant / Norm); // theta 与 Z轴的夹角
float YsinTheta = Yant / sinf(ThetaAnt);
float PhiAnt = (YsinTheta / abs(YsinTheta)) * acosf(Xant / (Norm * sinf(ThetaAnt)));
result.theta = ThetaAnt;
result.phi = PhiAnt;
result.pho = Norm;
return result;
}
/**
天线方向图插值方法以双线性插值算法为基础由theta与phi组合得到的矩阵图为基础数据通过插值计算的方法获取目标点的数据。
其中行是theta、列是phi
*/
__device__ float GPU_BillerInterpAntPattern(float* antpattern,
float starttheta, float startphi, float dtheta, float dphi,
long thetapoints, long phipoints,
float searththeta, float searchphi) {
float stheta = searththeta;
float sphi = searchphi;
if (stheta > 90) {
return 0;
}
else {}
float pthetaid = (stheta - starttheta) / dtheta;//
float pphiid = (sphi - startphi) / dphi;
long lasttheta = floorf(pthetaid);
long nextTheta = lasttheta + 1;
long lastphi = floorf(pphiid);
long nextPhi = lastphi + 1;
if (lasttheta < 0 || nextTheta < 0 || lastphi < 0 || nextPhi < 0 ||
lasttheta >= thetapoints || nextTheta >= thetapoints || lastphi >= phipoints || nextPhi >= phipoints)
{
return 0;
}
else {
float x = stheta;
float y = sphi;
float x1 = lasttheta * dtheta + starttheta;
float x2 = nextTheta * dtheta + starttheta;
float y1 = lastphi * dphi + startphi;
float y2 = nextPhi * dphi + startphi;
float z11 = antpattern[lasttheta * phipoints + lastphi];
float z12 = antpattern[lasttheta * phipoints + nextPhi];
float z21 = antpattern[nextTheta * phipoints + lastphi];
float z22 = antpattern[nextTheta * phipoints + nextPhi];
//z11 = powf(10, z11 / 10); // dB-> 线性
//z12 = powf(10, z12 / 10);
//z21 = powf(10, z21 / 10);
//z22 = powf(10, z22 / 10);
float GainValue = (z11 * (x2 - x) * (y2 - y)
+ z21 * (x - x1) * (y2 - y)
+ z12 * (x2 - x) * (y - y1)
+ z22 * (x - x1) * (y - y1));
GainValue = GainValue / ((x2 - x1) * (y2 - y1));
return GainValue;
}
}
__device__ cuComplex GPU_calculationEcho(float sigma0, float TransAnt, float ReciveAnt,
float localangle, float R, float slopeangle, float Pt, float lamda) {
float r = R;
float amp = Pt * TransAnt * ReciveAnt;
amp = amp * sigma0;
amp = amp / (powf(4 * LAMP_CUDA_PI, 2) * powf(r, 4)); // 反射强度
float phi = (-4 * LAMP_CUDA_PI / lamda) * r;
cuComplex echophi = make_cuComplex(0, phi);
cuComplex echophiexp = cuCexpf(echophi);
cuComplex echo;
echo.x = echophiexp.x * amp;
echo.y = echophiexp.y * amp;
return echo;
}
__global__ void CUDA_DistanceAB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* R, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
R[idx] = sqrtf(powf(Ax[idx] - Bx[idx], 2) + powf(Ay[idx] - By[idx], 2) + powf(Az[idx] - Bz[idx], 2));
}
}
__global__ void CUDA_B_DistanceA(float* Ax, float* Ay, float* Az, float Bx, float By, float Bz, float* R, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
R[idx] = sqrtf(powf(Ax[idx] - Bx, 2) + powf(Ay[idx] - By, 2) + powf(Az[idx] - Bz, 2));
}
}
__global__ void CUDA_make_VectorA_B(float sX, float sY, float sZ, float* tX, float* tY, float* tZ, float* RstX, float* RstY, float* RstZ, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
RstX[idx] = sX - tX[idx]; // 地面->天
RstY[idx] = sY - tY[idx];
RstZ[idx] = sZ - tZ[idx];
}
}
__global__ void CUDA_Norm_Vector(float* Vx, float* Vy, float* Vz, float* R, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
R[idx] = sqrtf(powf(Vx[idx], 2) + powf(Vy[idx], 2) + powf(Vz[idx], 2));
}
}
__global__ void CUDA_cosAngle_VA_AB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* anglecos, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float tAx = Ax[idx];
float tAy = Ay[idx];
float tAz = Az[idx];
float tBx = Bx[idx];
float tBy = By[idx];
float tBz = Bz[idx];
float AR = sqrtf(powf(tAx, 2) + powf(tAy, 2) + powf(tAz, 2));
float BR = sqrtf(powf(tBx, 2) + powf(tBy, 2) + powf(tBz, 2));
float dotAB = tAx * tBx + tAy * tBy + tAz * tBz;
float result = acosf(dotAB / (AR * BR));
anglecos[idx] = result;
}
}
__global__ void CUDA_SatelliteAntDirectNormal(float* RstX, float* RstY, float* RstZ,
float antXaxisX, float antXaxisY, float antXaxisZ,
float antYaxisX, float antYaxisY, float antYaxisZ,
float antZaxisX, float antZaxisY, float antZaxisZ,
float antDirectX, float antDirectY, float antDirectZ,
float* thetaAnt, float* phiAnt
, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float Xst = -1 * RstX[idx]; // 卫星 --> 地面
float Yst = -1 * RstY[idx];
float Zst = -1 * RstZ[idx];
float AntXaxisX = antXaxisX;
float AntXaxisY = antXaxisY;
float AntXaxisZ = antXaxisZ;
float AntYaxisX = antYaxisX;
float AntYaxisY = antYaxisY;
float AntYaxisZ = antYaxisZ;
float AntZaxisX = antZaxisX;
float AntZaxisY = antZaxisY;
float AntZaxisZ = antZaxisZ;
// 归一化
float RstNorm = sqrtf(Xst * Xst + Yst * Yst + Zst * Zst);
float AntXaxisNorm = sqrtf(AntXaxisX * AntXaxisX + AntXaxisY * AntXaxisY + AntXaxisZ * AntXaxisZ);
float AntYaxisNorm = sqrtf(AntYaxisX * AntYaxisX + AntYaxisY * AntYaxisY + AntYaxisZ * AntYaxisZ);
float AntZaxisNorm = sqrtf(AntZaxisX * AntZaxisX + AntZaxisY * AntZaxisY + AntZaxisZ * AntZaxisZ);
float Rx = Xst / RstNorm;
float Ry = Yst / RstNorm;
float Rz = Zst / RstNorm;
float Xx = AntXaxisX / AntXaxisNorm;
float Xy = AntXaxisY / AntXaxisNorm;
float Xz = AntXaxisZ / AntXaxisNorm;
float Yx = AntYaxisX / AntYaxisNorm;
float Yy = AntYaxisY / AntYaxisNorm;
float Yz = AntYaxisZ / AntYaxisNorm;
float Zx = AntZaxisX / AntZaxisNorm;
float Zy = AntZaxisY / AntZaxisNorm;
float Zz = AntZaxisZ / AntZaxisNorm;
float Xant = (Rx * Yy * Zz - Rx * Yz * Zy - Ry * Yx * Zz + Ry * Yz * Zx + Rz * Yx * Zy - Rz * Yy * Zx) / (Xx * Yy * Zz - Xx * Yz * Zy - Xy * Yx * Zz + Xy * Yz * Zx + Xz * Yx * Zy - Xz * Yy * Zx);
float Yant = -(Rx * Xy * Zz - Rx * Xz * Zy - Ry * Xx * Zz + Ry * Xz * Zx + Rz * Xx * Zy - Rz * Xy * Zx) / (Xx * Yy * Zz - Xx * Yz * Zy - Xy * Yx * Zz + Xy * Yz * Zx + Xz * Yx * Zy - Xz * Yy * Zx);
float Zant = (Rx * Xy * Yz - Rx * Xz * Yy - Ry * Xx * Yz + Ry * Xz * Yx + Rz * Xx * Yy - Rz * Xy * Yx) / (Xx * Yy * Zz - Xx * Yz * Zy - Xy * Yx * Zz + Xy * Yz * Zx + Xz * Yx * Zy - Xz * Yy * Zx);
// 计算theta 与 phi
float Norm = sqrtf(Xant * Xant + Yant * Yant + Zant * Zant); // 计算 pho
float ThetaAnt = acosf(Zant / Norm); // theta 与 Z轴的夹角
float PhiAnt = atanf(Yant / Xant); // -pi/2 ~pi/2
if (abs(Yant) < PRECISIONTOLERANCE) { // X轴上
PhiAnt = 0;
}
else if (abs(Xant) < PRECISIONTOLERANCE) { // Y轴上原点
if (Yant > 0) {
PhiAnt = PI / 2;
}
else {
PhiAnt = -PI / 2;
}
}
else if (Xant < 0) {
if (Yant > 0) {
PhiAnt = PI + PhiAnt;
}
else {
PhiAnt = -PI+PhiAnt ;
}
}
else { // Xant>0 X 正轴
}
if (isnan(PhiAnt)) {
printf("V=[%f,%f,%f];norm=%f;thetaAnt=%f;phiAnt=%f;\n", Xant, Yant, Zant,Norm, ThetaAnt, PhiAnt);
}
//if (abs(ThetaAnt - 0) < PRECISIONTOLERANCE) {
// PhiAnt = 0;
//}
//else {}
thetaAnt[idx] = ThetaAnt*r2d;
phiAnt[idx] = PhiAnt*r2d;
//printf("Rst=[%f,%f,%f];AntXaxis = [%f, %f, %f];AntYaxis=[%f,%f,%f];AntZaxis=[%f,%f,%f];phiAnt=%f;thetaAnt=%f;\n", Xst, Yst, Zst
// , AntXaxisX, AntXaxisY, AntXaxisZ
// , AntYaxisX, AntYaxisY, AntYaxisZ
// , AntZaxisX, AntZaxisY, AntZaxisZ
// , phiAnt[idx]
// , thetaAnt[idx]
//);
}
}
__global__ void CUDA_BillerInterpAntPattern(float* antpattern,
float starttheta, float startphi, float dtheta, float dphi,
long thetapoints, long phipoints,
float* searththeta, float* searchphi, float* searchantpattern,
long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float stheta = searththeta[idx];
float sphi = searchphi[idx];
float pthetaid = (stheta - starttheta) / dtheta;//
float pphiid = (sphi - startphi) / dphi;
long lasttheta = floorf(pthetaid);
long nextTheta = lasttheta + 1;
long lastphi = floorf(pphiid);
long nextPhi = lastphi + 1;
if (lasttheta < 0 || nextTheta < 0 || lastphi < 0 || nextPhi < 0 ||
lasttheta >= thetapoints || nextTheta >= thetapoints || lastphi >= phipoints || nextPhi >= phipoints)
{
searchantpattern[idx] = 0;
}
else {
float x = stheta;
float y = sphi;
float x1 = lasttheta * dtheta + starttheta;
float x2 = nextTheta * dtheta + starttheta;
float y1 = lastphi * dphi + startphi;
float y2 = nextPhi * dphi + startphi;
float z11 = antpattern[lasttheta * phipoints + lastphi];
float z12 = antpattern[lasttheta * phipoints + nextPhi];
float z21 = antpattern[nextTheta * phipoints + lastphi];
float z22 = antpattern[nextTheta * phipoints + nextPhi];
z11 = powf(10, z11 / 10);
z12 = powf(10, z12 / 10);
z21 = powf(10, z21 / 10);
z22 = powf(10, z22 / 10);
float GainValue = (z11 * (x2 - x) * (y2 - y)
+ z21 * (x - x1) * (y2 - y)
+ z12 * (x2 - x) * (y - y1)
+ z22 * (x - x1) * (y - y1));
GainValue = GainValue / ((x2 - x1) * (y2 - y1));
searchantpattern[idx] = GainValue;
}
}
}
__global__ void CUDA_Test_HelloWorld(float a, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
printf("\nidx:\t %d %d \n", idx, len);
}
__global__ void CUDA_RTPC(
float antPx, float antPy, float antPz,// 天线坐标
float antXaxisX, float antXaxisY, float antXaxisZ,
float antYaxisX, float antYaxisY, float antYaxisZ,
float antZaxisX, float antZaxisY, float antZaxisZ,
float antDirectX, float antDirectY, float antDirectZ,
float* demx, float* demy, float* demz, long* demcls,
float* demslopex, float* demslopey, float* demslopez, float* demslopeangle,
float* Tantpattern, float Tstarttheta, float Tstartphi, float Tdtheta, float Tdphi, long Tthetapoints, long Tphipoints,
float* Rantpattern, float Rstarttheta, float Rstartphi, float Rdtheta, float Rdphi, long Rthetapoints, long Rphipoints,
float lamda, float fs, float nearrange, float Pt, long Freqnumbers, // 参数
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen,// 地表覆盖类型-sigma插值对应函数-ulaby
cuComplex* outecho, int* d_echoAmpFID,
int linecount,int plusepoint) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
//printf("\nidx:\t %d %d %d\n", idx, linecount, plusepoint);
if (idx < linecount* plusepoint) {
long clsid = demcls[idx];
CUDAVector Rs{ antPx,antPy,antPz };
CUDAVector Rt{ demx[idx],demy[idx],demz[idx] };
CUDAVector Rst{ Rs.x - Rt.x,Rs.y - Rt.y,Rs.z - Rt.z };
CUDAVector Vslope{ demslopex[idx],demslopey[idx],demslopez[idx] };
float R = GPU_VectorNorm2(Rst); // 斜距
float slopeangle = demslopeangle[idx];
CUDAVectorEllipsoidal Rtanttheta = GPU_SatelliteAntDirectNormal( // 地面目标在天线的位置
Rst.x, Rst.y, Rst.z,
antXaxisX, antXaxisY, antXaxisZ,
antYaxisX, antYaxisY, antYaxisZ,
antZaxisX, antZaxisY, antZaxisZ,
antDirectX, antDirectY, antDirectZ);
float localangle = GPU_CosAngle_VectorA_VectorB(Rst, Vslope); // 距地入射角
float sigma = GPU_getSigma0dB(sigma0Paramslist[clsid], localangle * r2d);
sigma = powf(10.0, sigma / 10.0);// 后向散射系数
//printf("\ntheta: %f\t,%f ,%f ,%f ,%f ,%f ,%f \n", localangle * r2d, sigma0Paramslist[clsid].p1, sigma0Paramslist[clsid].p2, sigma0Paramslist[clsid].p3,
// sigma0Paramslist[clsid].p4, sigma0Paramslist[clsid].p5, sigma0Paramslist[clsid].p6);
// 发射方向图
float transPattern = GPU_BillerInterpAntPattern(Tantpattern,
Tstarttheta, Tstartphi, Tdtheta, Tdphi, Tthetapoints, Tphipoints,
Rtanttheta.theta, Rtanttheta.phi) * r2d;
// 接收方向图
float receivePattern = GPU_BillerInterpAntPattern(Rantpattern,
Rstarttheta, Rstartphi, Rdtheta, Rdphi, Rthetapoints, Rphipoints,
Rtanttheta.theta, Rtanttheta.phi) * r2d;
// 计算振幅、相位
float amp = Pt * transPattern * receivePattern * sigma * (1 / cos(slopeangle) * sin(localangle));
amp = amp / (powf(4 * LAMP_CUDA_PI, 2) * powf(R, 4));
float phi = (-4 * LAMP_CUDA_PI / lamda) * R;
// 构建回波
cuComplex echophi = make_cuComplex(0, phi);
cuComplex echophiexp = cuCexpf(echophi);
float timeR = 2 * (R - nearrange) / LIGHTSPEED * fs;
long timeID = floorf(timeR);
if (timeID < 0 || timeID >= Freqnumbers) {
timeID = 0;
amp = 0;
}
else {}
cuComplex echo;
echo.x = echophiexp.x * amp;
echo.y = echophiexp.y * amp;
outecho[idx] = echo;
d_echoAmpFID[idx] = timeID;
}
}
__global__ void CUDA_TBPImage(
float* antPx, float* antPy, float* antPz,
float* imgx, float* imgy, float* imgz,
cuComplex* echoArr, cuComplex* imgArr,
float freq, float fs, float Rnear, float Rfar,
long rowcount, long colcount,
long prfid, long freqcount
) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
//printf("\nidx:\t %d %d %d\n", idx, linecount, plusepoint);
if (idx < rowcount * colcount) {
float R = sqrtf(powf(antPx[prfid] - imgx[idx], 2) + powf(antPy[prfid] - imgy[idx], 2) + powf(antPz[prfid] - imgz[idx], 2));
float Ridf = ((R - Rnear) * 2 / LIGHTSPEED) * fs;
long Rid = floorf(Ridf);
if(Rid <0|| Rid >= freqcount){}
else {
float factorj = freq * 4 * PI / LIGHTSPEED;
cuComplex Rphi =cuCexpf(make_cuComplex(0, factorj * R));// 校正项
imgArr[idx] = cuCaddf(imgArr[idx], cuCmulf(echoArr[Rid] , Rphi));// 矫正
}
}
}
__global__ void CUDA_calculationEcho(float* sigma0, float* TransAnt, float* ReciveAnt,
float* localangle, float* R, float* slopeangle,
float nearRange, float Fs, float Pt, float lamda, long FreqIDmax,
cuComplex* echoArr, long* FreqID,
long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float r = R[idx];
float amp = Pt * TransAnt[idx] * ReciveAnt[idx];
amp = amp * sigma0[idx];
amp = amp / (powf(4 * LAMP_CUDA_PI, 2) * powf(r, 4)); // 反射强度
// 处理相位
float phi = (-4 * LAMP_CUDA_PI / lamda) * r;
cuComplex echophi = make_cuComplex(0, phi);
cuComplex echophiexp = cuCexpf(echophi);
float timeR = 2 * (r - nearRange) / LIGHTSPEED * Fs;
long timeID = floorf(timeR);
if (timeID < 0 || timeID >= FreqIDmax) {
timeID = 0;
amp = 0;
}
cuComplex echo;
echo.x = echophiexp.x * amp;
echo.y = echophiexp.y * amp;
echoArr[idx] = echo;
FreqID[idx] = timeID;
}
}
__global__ void CUDA_AntPatternInterpGain(float* anttheta, float* antphi, float* gain,
float* antpattern, float starttheta, float startphi, float dtheta, float dphi, int thetapoints, int phipoints, long len) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float temptheta = anttheta[idx];
float tempphi = antphi[idx];
float antPatternGain = GPU_BillerInterpAntPattern(antpattern,
starttheta, startphi, dtheta, dphi, thetapoints, phipoints,
temptheta, tempphi) ;
gain[idx] = antPatternGain;
}
}
//__global__ void Sigma0InterpPixel(long* demcls, float* demslopeangle, CUDASigmaParam* sigma0Paramslist, float* localangle, float* sigma0list, long sigmaparamslistlen, long len)
//{
// long idx = blockIdx.x * blockDim.x + threadIdx.x;
// if (idx < len) {
// long clsid = demcls[idx];
// if(clsid<=)
// sigma0list[idx] = 0;
// }
//}
__global__ void CUDA_InterpSigma(
long* demcls, float* sigmaAmp, float* localanglearr, long len,
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
long clsid = demcls[idx];
float localangle = localanglearr[idx] * r2d;
CUDASigmaParam tempsigma = sigma0Paramslist[clsid];
//printf("cls:%d;localangle=%f;\n",clsid, localangle);
if (localangle < 0 || localangle >= 90) {
sigmaAmp[idx] = 0;
}
else {}
if (abs(tempsigma.p1)< PRECISIONTOLERANCE&&
abs(tempsigma.p2) < PRECISIONTOLERANCE &&
abs(tempsigma.p3) < PRECISIONTOLERANCE &&
abs(tempsigma.p4) < PRECISIONTOLERANCE&&
abs(tempsigma.p5) < PRECISIONTOLERANCE&&
abs(tempsigma.p6) < PRECISIONTOLERANCE
) {
sigmaAmp[idx] = 0;
}
else {
float sigma = GPU_getSigma0dB(tempsigma, localangle);
sigma = powf(10.0, sigma / 10.0);// 后向散射系数
//printf("cls:%d;localangle=%f;sigma0=%f;\n", clsid, localangle, sigma);
sigmaAmp[idx] = sigma;
}
}
}
//错误提示
void checkCudaError(cudaError_t err, const char* msg) {
if (err != cudaSuccess) {
std::cerr << "CUDA error: " << msg << " (" << cudaGetErrorString(err) << ")" << std::endl;
exit(EXIT_FAILURE);
}
}
// 主机参数内存声明
extern "C" void* mallocCUDAHost(long memsize) {
void* ptr;
cudaMallocHost(&ptr, memsize);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("mallocCUDAHost CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
return ptr;
}
// 主机参数内存释放
extern "C" void FreeCUDAHost(void* ptr) {
cudaFreeHost(ptr);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("FreeCUDAHost CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
// GPU参数内存声明
extern "C" void* mallocCUDADevice(long memsize) {
void* ptr;
cudaMalloc(&ptr, memsize);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("mallocCUDADevice CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
return ptr;
}
// GPU参数内存释放
extern "C" void FreeCUDADevice(void* ptr) {
cudaFree(ptr);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("FreeCUDADevice CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
// GPU 内存数据转移
extern "C" void HostToDevice(void* hostptr, void* deviceptr, long memsize) {
cudaMemcpy(deviceptr, hostptr, memsize, cudaMemcpyHostToDevice);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("HostToDevice CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void DeviceToHost(void* hostptr, void* deviceptr, long memsize) {
cudaMemcpy(hostptr, deviceptr, memsize, cudaMemcpyDeviceToHost);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("DeviceToHost CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDATestHelloWorld(float a,long len) {
// 设置 CUDA 核函数的网格和块的尺寸
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_Test_HelloWorld << <numBlocks, blockSize >> > (a, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("FreeCUDADevice CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
void CUDATBPImage(float* antPx, float* antPy, float* antPz,
float* imgx, float* imgy, float* imgz,
cuComplex* echoArr, cuComplex* imgArr,
float freq, float fs, float Rnear, float Rfar,
long rowcount, long colcount,
long prfid, long freqcount)
{
int blockSize = 256; // 每个块的线程数
int numBlocks = (rowcount * colcount + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
//printf("\nCUDA_RTPC_SiglePRF blockSize:%d ,numBlock:%d\n",blockSize,numBlocks);
// 调用 CUDA 核函数 CUDA_RTPC_Kernel
CUDA_TBPImage << <numBlocks, blockSize >> > (
antPx, antPy, antPz,
imgx, imgy, imgz,
echoArr, imgArr,
freq, fs, Rnear, Rfar,
rowcount, colcount,
prfid, freqcount
);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDATBPImage CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void distanceAB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* R, long len) {
// 设置 CUDA 核函数的网格和块的尺寸
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_DistanceAB << <numBlocks, blockSize >> > (Ax, Ay, Az, Bx, By, Bz, R, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void BdistanceAs(float* Ax, float* Ay, float* Az, float Bx, float By, float Bz, float* R, long len) {
// 设置 CUDA 核函数的网格和块的尺寸
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_B_DistanceA << <numBlocks, blockSize >> > (Ax, Ay, Az, Bx, By, Bz, R, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void make_VectorA_B(float sX, float sY, float sZ, float* tX, float* tY, float* tZ, float* RstX, float* RstY, float* RstZ, long len) {
// 设置 CUDA 核函数的网格和块的尺寸
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_make_VectorA_B << <numBlocks, blockSize >> > (sX, sY, sZ, tX, tY, tZ, RstX, RstY, RstZ, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void Norm_Vector(float* Vx, float* Vy, float* Vz, float* R, long len) {
// 设置 CUDA 核函数的网格和块的尺寸
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_Norm_Vector << <numBlocks, blockSize >> > (Vx, Vy, Vz, R, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void cosAngle_VA_AB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* anglecos, long len) {
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_cosAngle_VA_AB << <numBlocks, blockSize >> > (Ax, Ay, Az, Bx, By, Bz, anglecos, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void SatelliteAntDirectNormal(float* RstX, float* RstY, float* RstZ,
float antXaxisX, float antXaxisY, float antXaxisZ,
float antYaxisX, float antYaxisY, float antYaxisZ,
float antZaxisX, float antZaxisY, float antZaxisZ,
float antDirectX, float antDirectY, float antDirectZ,
float* thetaAnt, float* phiAnt
, long len) {
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_SatelliteAntDirectNormal << <numBlocks, blockSize >> > (RstX, RstY, RstZ,
antXaxisX, antXaxisY, antXaxisZ,
antYaxisX, antYaxisY, antYaxisZ,
antZaxisX, antZaxisY, antZaxisZ,
antDirectX, antDirectY, antDirectZ,
thetaAnt, phiAnt
, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void AntPatternInterpGain(float* anttheta, float* antphi, float* gain,
float* antpattern, float starttheta, float startphi, float dtheta, float dphi, int thetapoints, int phipoints, long len) {
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
//printf("\nCUDA_RTPC_SiglePRF blockSize:%d ,numBlock:%d\n", blockSize, numBlocks);
CUDA_AntPatternInterpGain << <numBlocks, blockSize >> > ( anttheta,antphi, gain,
antpattern,
starttheta, startphi, dtheta, dphi, thetapoints, phipoints,
len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDARTPCPRF(float antPx, long len) {
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
printf("\nCUDA_RTPC_SiglePRF blockSize:%d ,numBlock:%d\n", blockSize, numBlocks);
CUDA_Test_HelloWorld << <numBlocks, blockSize >> > (antPx, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void calculationEcho(float* sigma0, float* TransAnt, float* ReciveAnt,
float* localangle, float* R, float* slopeangle,
float nearRange, float Fs, float pt, float lamda, long FreqIDmax,
cuComplex* echoAmp, long* FreqID,
long len)
{
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_calculationEcho << <numBlocks, blockSize >> > (sigma0, TransAnt, ReciveAnt,
localangle, R, slopeangle,
nearRange, Fs, pt, lamda, FreqIDmax,
echoAmp, FreqID,
len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDA_RTPC_SiglePRF(
float antPx, float antPy, float antPZ,
float antXaxisX, float antXaxisY, float antXaxisZ,
float antYaxisX, float antYaxisY, float antYaxisZ,
float antZaxisX, float antZaxisY, float antZaxisZ,
float antDirectX, float antDirectY, float antDirectZ,
float* demx, float* demy, float* demz, long* demcls,
float* demslopex, float* demslopey, float* demslopez, float* demslopeangle,
float* Tantpattern, float Tstarttheta, float Tstartphi, float Tdtheta, float Tdphi, int Tthetapoints, int Tphipoints,
float* Rantpattern, float Rstarttheta, float Rstartphi, float Rdtheta, float Rdphi, int Rthetapoints, int Rphipoints,
float lamda, float fs, float nearrange, float Pt, int Freqnumbers,
CUDASigmaParam* sigma0Paramslist, int sigmaparamslistlen,
cuComplex* outecho, int* d_echoAmpFID,
int linecount,int colcount) {
int blockSize = 256; // 每个块的线程数
int numBlocks = (linecount* colcount + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
//printf("\nCUDA_RTPC_SiglePRF blockSize:%d ,numBlock:%d\n",blockSize,numBlocks);
// 调用 CUDA 核函数 CUDA_RTPC_Kernel
CUDA_RTPC << <numBlocks, blockSize >> > (
antPx, antPy, antPZ,// 天线坐标
antXaxisX, antXaxisY, antXaxisZ, // 天线坐标系
antYaxisX, antYaxisY, antYaxisZ, //
antZaxisX, antZaxisY, antZaxisZ,
antDirectX, antDirectY, antDirectZ,// 天线指向
demx, demy, demz,
demcls, // 地面坐标
demslopex, demslopey, demslopez, demslopeangle,// 地面坡度
Tantpattern, Tstarttheta, Tstartphi, Tdtheta, Tdphi, Tthetapoints, Tphipoints,// 天线方向图相关
Rantpattern, Rstarttheta, Rstartphi, Rdtheta, Rdphi, Rthetapoints, Rphipoints,// 天线方向图相关
lamda, fs, nearrange, Pt, Freqnumbers, // 参数
sigma0Paramslist, sigmaparamslistlen,// 地表覆盖类型-sigma插值对应函数-ulaby
outecho, d_echoAmpFID,
linecount, colcount
);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDAInterpSigma(
long* demcls,float* sigmaAmp, float* localanglearr,long len,
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen) {// 地表覆盖类型-sigma插值对应函数-ulaby
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_InterpSigma << <numBlocks, blockSize >> > (
demcls, sigmaAmp, localanglearr, len,
sigma0Paramslist, sigmaparamslistlen
);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
#endif

View File

@ -1,452 +0,0 @@
#ifndef GPUTOOL_H
#define GPUTOOL_H
#ifdef __CUDANVCC___
#include "BaseConstVariable.h"
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
#include <cublas_v2.h>
#include <cuComplex.h>
#define __CUDADEBUG__
// 默认显存分布
enum LAMPGPUDATETYPE {
LAMP_LONG,
LAMP_FLOAT,
LAMP_COMPLEXFLOAT
};
extern "C" struct CUDASigmaParam {
float p1;
float p2;
float p3;
float p4;
float p5;
float p6;
};
extern "C" struct CUDAVector {
float x;
float y;
float z;
};
extern "C" struct CUDAVectorEllipsoidal {
float theta;
float phi;
float pho;
};
// GPU 内存函数
extern "C" void* mallocCUDAHost( long memsize); // 主机内存声明
extern "C" void FreeCUDAHost(void* ptr);
extern "C" void* mallocCUDADevice( long memsize); // GPU内存声明
extern "C" void FreeCUDADevice(void* ptr);
extern "C" void HostToDevice(void* hostptr, void* deviceptr, long memsize);//GPU 内存数据转移 设备 -> GPU
extern "C" void DeviceToHost(void* hostptr, void* deviceptr, long memsize);//GPU 内存数据转移 GPU -> 设备
// 仿真所需的常用函数
extern "C" void distanceAB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* R, long member);
extern "C" void BdistanceAs(float* Ax, float* Ay, float* Az, float Bx, float By, float Bz, float* R, long member);
extern "C" void make_VectorA_B(float sX, float sY, float sZ, float* tX, float* tY, float* tZ, float* RstX, float* RstY, float* RstZ, long member);
extern "C" void Norm_Vector(float* Vx, float* Vy, float* Vz, float* R, long member);
extern "C" void cosAngle_VA_AB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* anglecos, long len);
extern "C" void SatelliteAntDirectNormal(float* RstX, float* RstY, float* RstZ, float antXaxisX, float antXaxisY, float antXaxisZ, float antYaxisX, float antYaxisY, float antYaxisZ, float antZaxisX, float antZaxisY, float antZaxisZ, float antDirectX, float antDirectY, float antDirectZ, float* thetaAnt, float* phiAnt, long len);
extern "C" void AntPatternInterpGain(float* anttheta, float* antphi, float* gain, float* antpattern, float starttheta, float startphi, float dtheta, float dphi, int thetapoints, int phipoints,long len);
extern "C" void CUDA_RTPC_SiglePRF(
float antPx, float antPy, float antPZ,
float antXaxisX, float antXaxisY, float antXaxisZ,
float antYaxisX, float antYaxisY, float antYaxisZ,
float antZaxisX, float antZaxisY, float antZaxisZ,
float antDirectX, float antDirectY, float antDirectZ,
float* demx, float* demy, float* demz, long* demcls,
float* demslopex, float* demslopey, float* demslopez, float* demslopeangle,
float* Tantpattern, float Tstarttheta, float Tstartphi, float Tdtheta, float Tdphi, int Tthetapoints, int Tphipoints,
float* Rantpattern, float Rstarttheta, float Rstartphi, float Rdtheta, float Rdphi, int Rthetapoints, int Rphipoints,
float lamda, float fs, float nearrange, float Pt, int Freqnumbers,
CUDASigmaParam* sigma0Paramslist, int sigmaparamslistlen,
cuComplex* outecho, int* d_echoAmpFID,
int linecount, int colcount
);
extern "C" void CUDARTPCPRF(float antPx, long len);
extern "C" void CUDATestHelloWorld(float a, long len);
extern "C" void CUDATBPImage(
float* antPx,
float* antPy,
float* antPz,
float* imgx,
float* imgy,
float* imgz,
cuComplex* echoArr,
cuComplex* imgArr,
float freq, float fs, float Rnear, float Rfar,
long rowcount, long colcount,
long prfid, long freqcount
);
extern "C" void calculationEcho(float* sigma0, float* TransAnt, float* ReciveAnt,
float* localangle, float* R, float* slopeangle,
float nearRange, float Fs, float pt, float lamda, long FreqIDmax,
cuComplex* echoAmp, long* FreqID,
long len);
extern "C" void CUDAInterpSigma(
long* demcls, float* sigmaAmp, float* localanglearr, long len,
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen);
#endif
#endif
/**
*
double* databuffer = new double[nXSize * nYSize * 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);
Eigen::MatrixXcd rasterData(nYSize, nXSize); // 使用Eigen的MatrixXcd
for(size_t i = 0; i < nYSize; i++) {
for(size_t j = 0; j < nXSize; j++) {
rasterData(i, j) = std::complex<double>(databuffer[i * nXSize * 2 + j * 2],
databuffer[i * nXSize * 2 + j * 2 + 1]);
}
}
delete[] databuffer;
gdalImage demxyz(demxyzPath);// 地面点坐标
gdalImage demlandcls(this->LandCoverPath);// 地表覆盖类型
gdalImage demsloperxyz(this->demsloperPath);// 地面坡向
omp_lock_t lock; // 定义锁
omp_init_lock(&lock); // 初始化锁
long start_ids = 1250;
for (start_ids = 1; start_ids < demxyz.height; start_ids = start_ids + line_invert) { // 8+ 17 + 0.3 MB
QDateTime current = QDateTime::currentDateTime();
long pluseStep = Memory1MB * 100 / 3 / PlusePoint;
if (pluseStep * num_thread * 3 > this->PluseCount) {
pluseStep = this->PluseCount / num_thread / 3;
}
pluseStep = pluseStep > 50 ? pluseStep : 50;
qDebug() << current.toString("yyyy-MM-dd HH:mm:ss.zzz") << " \tstart \t " << start_ids << " - " << start_ids + line_invert << "\t" << demxyz.height << "\t pluseCount:\t" << pluseStep;
// 文件读取
Eigen::MatrixXd dem_x = demxyz.getData(start_ids - 1, 0, line_invert + 1, demxyz.width, 1); //
Eigen::MatrixXd dem_y = demxyz.getData(start_ids - 1, 0, line_invert + 1, demxyz.width, 2); //
Eigen::MatrixXd dem_z = demxyz.getData(start_ids - 1, 0, line_invert + 1, demxyz.width, 3); //
// 地表覆盖
std::shared_ptr<long> dem_landcls = readDataArr<long>(demlandcls, start_ids - 1, 0, line_invert + 1, demxyz.width, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD); // 地表覆盖类型
long* dem_landcls_ptr = dem_landcls.get();
double localAngle = 30.0;
bool sigmaNoZeroFlag = true;
for (long ii = 0; ii < dem_x.rows(); ii++) {
for (long jj = 0; jj < dem_y.cols(); jj++) {
if (0 != this->SigmaDatabasePtr->getAmp(dem_landcls_ptr[dem_x.cols() * ii + jj], localAngle, polartype)) {
sigmaNoZeroFlag = false;
break;
}
}
if (!sigmaNoZeroFlag) {
break;
}
}
if (sigmaNoZeroFlag) {
continue;
}
//#ifdef DEBUGSHOWDIALOG
// dialog->load_double_MatrixX_data(dem_z, "dem_z");
//#endif
Eigen::MatrixXd demsloper_x = demsloperxyz.getData(start_ids - 1, 0, line_invert + 1, demxyz.width, 1); //
Eigen::MatrixXd demsloper_y = demsloperxyz.getData(start_ids - 1, 0, line_invert + 1, demxyz.width, 2); //
Eigen::MatrixXd demsloper_z = demsloperxyz.getData(start_ids - 1, 0, line_invert + 1, demxyz.width, 3); //
Eigen::MatrixXd sloperAngle = demsloperxyz.getData(start_ids - 1, 0, line_invert + 1, demxyz.width, 4); //
sloperAngle = sloperAngle.array() * T180_PI;
long dem_rows = dem_x.rows();
long dem_cols = dem_x.cols();
long freqidx = 0;//
#ifdef DEBUGSHOWDIALOG
ImageShowDialogClass* dialog = new ImageShowDialogClass(nullptr);
dialog->show();
Eigen::MatrixXd landaArr = Eigen::MatrixXd::Zero(dem_rows, dem_cols);
for (long i = 0; i < dem_rows; i++) {
for (long j = 0; j < dem_cols; j++) {
landaArr(i, j) = dem_landcls.get()[i * dem_cols + j];
}
}
dialog->load_double_MatrixX_data(landaArr, "landCover");
#endif
//qDebug() << " pluse bolck size :\t " << pluseStep << " all size:\t" << this->PluseCount;
long processNumber = 0;
#pragma omp parallel for
for (long startprfidx = 0; startprfidx < this->PluseCount; startprfidx = startprfidx + pluseStep) { // 17 + 0.3 MB
long prfcount_step = startprfidx + pluseStep < this->PluseCount ? pluseStep : this->PluseCount - startprfidx;
Eigen::MatrixXcd echoPluse = Eigen::MatrixXcd::Zero(prfcount_step, PlusePoint); // 当前脉冲的回波积分情况
// 内存预分配
Eigen::MatrixXd Rst_x = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd Rst_y = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd Rst_z = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd R = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd localangle = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd Vst_x = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd Vst_y = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd Vst_z = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd fde = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd fr = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd Rx = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd sigam = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd echoAmp = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols()).array() + Pt;
Eigen::MatrixXd Rphi = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd TimeRange = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd TransAnt = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd ReciveAnt = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd AntTheta = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
Eigen::MatrixXd AntPhi = Eigen::MatrixXd::Zero(dem_x.rows(), dem_x.cols());
double minR = 0, maxR = 0;
double minLocalAngle = 0, maxLocalAngle = 0;
Vector3D Rt = { 0,0,0 };
SatelliteOribtNode oRs = SatelliteOribtNode{ 0 };;
Vector3D p0 = {}, slopeVector = {}, sateAntDirect = {};
Vector3D Rs = {}, Vs = {}, Ast = {};
SatelliteAntDirect antdirectNode = {};
std::complex<double> echofreq;
std::complex<double> Imag1(0, 1);
double TAntPattern = 1; // 发射天线方向图
double RAntPanttern = 1;// 接收天线方向图
double maxechoAmp = 1;
double tempAmp = 1;
for (long prfidx = 0; prfidx < prfcount_step; prfidx++)
{
oRs = sateOirbtNodes[prfidx + startprfidx];
// 计算天线方向图
for (long jj = 1; jj < dem_cols - 1; jj++) {
for (long ii = 1; ii < dem_rows - 1; ii++) {
p0.x = dem_x(ii, jj);
p0.y = dem_y(ii, jj);
p0.z = dem_z(ii, jj);
this->TaskSetting->getSatelliteAntDirectNormal(oRs, p0, antdirectNode);
//antdirectNode.ThetaAnt = antdirectNode.ThetaAnt * r2d;
//antdirectNode.PhiAnt = antdirectNode.PhiAnt * r2d;
AntTheta(ii, jj) = antdirectNode.ThetaAnt * r2d;
AntPhi(ii, jj) = antdirectNode.PhiAnt * r2d;
}
}
// 计算发射天线方向图
for (long jj = 1; jj < dem_cols - 1; jj++) {
for (long ii = 1; ii < dem_rows - 1; ii++) {
TransformPattern->getGainLinear(AntTheta(ii, jj), AntPhi(ii, jj), TransAnt(ii, jj));
//TransAnt(ii, jj) = TAntPattern;
}
}
// 计算接收天线方向图
for (long jj = 1; jj < dem_cols - 1; jj++) {
for (long ii = 1; ii < dem_rows - 1; ii++) {
TransformPattern->getGainLinear(AntTheta(ii, jj), AntPhi(ii, jj), ReciveAnt(ii, jj));
//ReciveAnt(ii, jj) = RAntPanttern;
}
}
// 计算经过增益的能量
echoAmp = Pt * TransAnt.array() * ReciveAnt.array();
maxechoAmp = echoAmp.maxCoeff();
if (std::abs(maxechoAmp) < PRECISIONTOLERANCE) { // 这种情况下,不在合成孔径范围中
continue;
}
Rs.x = sateOirbtNodes[prfidx + startprfidx].Px; // 卫星位置
Rs.y = sateOirbtNodes[prfidx + startprfidx].Py;
Rs.z = sateOirbtNodes[prfidx + startprfidx].Pz;
Vs.x = sateOirbtNodes[prfidx + startprfidx].Vx; // 卫星速度
Vs.y = sateOirbtNodes[prfidx + startprfidx].Vy;
Vs.z = sateOirbtNodes[prfidx + startprfidx].Vz;
Ast.x = sateOirbtNodes[prfidx + startprfidx].AVx;// 卫星加速度
Ast.y = sateOirbtNodes[prfidx + startprfidx].AVy;
Ast.z = sateOirbtNodes[prfidx + startprfidx].AVz;
Rst_x = Rs.x - dem_x.array(); // Rst = Rs - Rt;
Rst_y = Rs.y - dem_y.array();
Rst_z = Rs.z - dem_z.array();
R = (Rst_x.array().pow(2) + Rst_y.array().pow(2) + Rst_z.array().pow(2)).array().sqrt(); // R
minR = R.minCoeff();
maxR = R.maxCoeff();
//qDebug() << "minR:\t" << minR << " maxR:\t" << maxR;
if (maxR<NearRange || minR>FarRange) {
continue;
}
else {}
// getCosAngle
// double c = dot(a, b) / (getlength(a) * getlength(b));
// return acos(c > 1 ? 1 : c < -1 ? -1 : c) * r2d;
// localangle = getCosAngle(Rst, slopeVector) * T180_PI; // 注意这个只能实时计算,因为非实时计算代价太大
localangle = (Rst_x.array() * demsloper_x.array() + Rst_y.array() * demsloper_y.array() + Rst_z.array() * demsloper_z.array()).array(); // dot(a, b)
localangle = localangle.array() / R.array();
localangle = localangle.array() / (demsloper_x.array().pow(2) + demsloper_y.array().pow(2) + demsloper_z.array().pow(2)).array().sqrt().array();
localangle = localangle.array().acos(); // 弧度值
minLocalAngle = localangle.minCoeff();
maxLocalAngle = localangle.maxCoeff();
if (maxLocalAngle<0 || minLocalAngle>PI / 2) {
continue;
}
else {}
//Vst_x = Vs.x + 1 * earthRoute * dem_y.array(); // Vst = Vs - Vt;
//Vst_y = Vs.y - 1 * earthRoute * dem_x.array();
//Vst_z = Vs.z - Eigen::MatrixXd::Zero(dem_x.rows(), dem_y.cols()).array();
//// 计算多普勒中心频率 Rst, Vst : ( - 2 / lamda) * dot(Rs - Rt, Vs - Vt) / R; // 星载合成孔径雷达原始回波数据模拟研究 3.18
//fde = (-2 / lamda) * (Rst_x.array() * Vst_x.array() + Rst_y.array() * Vst_y.array() + Rst_z.array() * Vst_z.array()).array() / (R.array());
//// 计算多普勒频率斜率 // 星载合成孔径雷达原始回波数据模拟研究 3.19
//// -(2/lamda)*( dot(Vs - Vt, Vs - Vt)/R + dot(Ast, Rs - Rt)/R - std::pow(dot(Vs - Vt, Rs - Rt),2 )/std::pow(R,3));
//fr = (-2 / lamda) *
// (Vst_x.array() * Vst_x.array() + Vst_y.array() * Vst_y.array() + Vst_z.array() * Vst_z.array()).array() / (R.array()) +
// (-2 / lamda) *
// (Ast.x * Rst_x.array() + Ast.y * Rst_y.array() + Ast.z * Rst_z.array()).array() / (R.array()) -
// (-2 / lamda) *
// (Vst_x.array() * Rst_x.array() + Vst_y.array() * Rst_y.array() + Vst_z.array() * Rst_z.array()).array().pow(2) / (R.array().pow(3));
// 计算回波
Rx = R;// -(lamda / 2) * (fde * TRx + 0.5 * fr * TRx * TRx); // 斜距历程值
// 逐点计算 this->SigmaDatabasePtr->getAmp(covercls, localangle, polartype); // 后向散射系数 HH
for (long ii = 0; ii < dem_x.rows(); ii++) {
for (long jj = 0; jj < dem_y.cols(); jj++) {
sigam(ii, jj) = this->SigmaDatabasePtr->getAmp(dem_landcls_ptr[dem_x.cols() * ii + jj], localangle(ii, jj) * r2d, polartype);
}
}
if (sigam.maxCoeff() > 0) {}
else {
continue;
}
// projArea = 1 / std::cos(sloperAngle) * std::sin(localangle); // 投影面积系数,单位投影面积 1m x 1m --注意这里是假设,后期再补充
// echoAmp = projArea*TAntPattern * RAntPanttern * sigam / (4 * PI * R * R);
echoAmp = echoAmp.array() * sigam.array() * (1 / sloperAngle.array().cos() * localangle.array().sin()); // 反射强度
echoAmp = echoAmp.array() / (4 * PI * R.array().pow(2)); // 距离衰减
Rphi = -4 * PI / lamda * Rx.array();// 距离徙动相位
// 积分
TimeRange = ((2 * R.array() / LIGHTSPEED - TimgNearRange).array() * Fs).array();
double localAnglepoint = -1;
long prf_freq_id = 0;
for (long jj = 1; jj < dem_cols - 1; jj++) {
for (long ii = 1; ii < dem_rows - 1; ii++) {
prf_freq_id = std::floor(TimeRange(ii, jj));
if (prf_freq_id < 0 || prf_freq_id >= PlusePoint || localangle(ii, jj) < 0 || localangle(ii, jj) > PI / 2 || echoAmp(ii, jj) == 0) {
continue;
}
echofreq = echoAmp(ii, jj) * std::exp(Rphi(ii, jj) * Imag1);
echoPluse(prfidx, prf_freq_id) = echoPluse(prfidx, prf_freq_id) + echofreq;
}
}
#ifdef DEBUGSHOWDIALOG
ImageShowDialogClass* localangledialog = new ImageShowDialogClass(dialog);
localangledialog->show();
localangledialog->load_double_MatrixX_data(localangle.array() * r2d, "localangle");
ImageShowDialogClass* sigamdialog = new ImageShowDialogClass(dialog);
sigamdialog->show();
sigamdialog->load_double_MatrixX_data(TimeRange, "TimeRange");
ImageShowDialogClass* ampdialog = new ImageShowDialogClass(dialog);
ampdialog->show();
ampdialog->load_double_MatrixX_data(echoAmp, "echoAmp");
Eigen::MatrixXd echoPluseamp = echoPluse.array().abs().cast<double>().array();
ImageShowDialogClass* echoampdialog = new ImageShowDialogClass(dialog);
echoampdialog->show();
echoampdialog->load_double_MatrixX_data(echoPluseamp, "echoPluseamp");
dialog->exec();
#endif
//qDebug() << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss.zzz") << " end " << prfidx;
}
//qDebug() << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss.zzz")<<" step "<< prfcount_step;
omp_set_lock(&lock); // 回波整体赋值处理
for (long prfidx = 0; prfidx < prfcount_step; prfidx++) {
for (long freqidx = 0; freqidx < PlusePoint; freqidx++)
{
//qDebug() << prfidx << " " << freqidx << " " << echoPluse(prfidx, freqidx).real() << " + " << echoPluse(prfidx, freqidx).imag() << " j";
echo.get()[(prfidx + startprfidx) * PlusePoint + freqidx] = echo.get()[(prfidx + startprfidx) * PlusePoint + freqidx] + echoPluse(prfidx, freqidx);
}
}
//this->EchoSimulationData->saveEchoArr(echo, 0, PluseCount);
omp_unset_lock(&lock); // 解锁
//qDebug() << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss.zzz") << " step 2" << prfcount_step;
}
omp_set_lock(&lock); // 保存文件
processNumber = processNumber + pluseStep;
this->EchoSimulationData->saveEchoArr(echo, 0, PluseCount);
omp_unset_lock(&lock); // 解锁
qDebug() << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss.zzz") << " \t " << start_ids << "\t--\t " << start_ids + line_invert << "\t/\t" << demxyz.height;
}
omp_destroy_lock(&lock); // 销毁锁
*/

View File

@ -1,126 +0,0 @@
#pragma once
#ifndef _GEOOPERATOR_H
#define _GEOOPERATOR_H
#include "BaseConstVariable.h"
#include <Eigen/Core>
#include <Eigen/Dense>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <iostream>
/// <summary>
/// 将经纬度转换为地固参心坐标系
/// </summary>
/// <param name="XYZP">经纬度点--degree</param>
/// <returns>投影坐标系点</returns>
Landpoint LLA2XYZ(const Landpoint& LLA);
void LLA2XYZ(const Landpoint& LLA,Point3& XYZ);
Eigen::MatrixXd LLA2XYZ(Eigen::MatrixXd landpoint);
/// <summary>
/// 将地固参心坐标系转换为经纬度
/// </summary>
/// <param name="XYZ">固参心坐标系</param>
/// <returns>经纬度--degree</returns>
Landpoint XYZ2LLA(const Landpoint& XYZ);
Landpoint operator +(const Landpoint& p1, const Landpoint& p2);
Landpoint operator -(const Landpoint& p1, const Landpoint& p2);
bool operator ==(const Landpoint& p1, const Landpoint& p2);
Landpoint operator *(const Landpoint& p, double scale);
double getAngle(const Landpoint& a, const Landpoint& b);
double dot(const Landpoint& p1, const Landpoint& p2);
double getlength(const Landpoint& p1);
Landpoint crossProduct(const Landpoint& a, const Landpoint& b);
Landpoint getSlopeVector(const Landpoint& p0, const Landpoint& p1, const Landpoint& p2, const Landpoint& p3, const Landpoint& p4, bool inLBH=true);
double getlocalIncAngle(Landpoint& satepoint, Landpoint& landpoint, Landpoint& slopeVector);
float cross2d(Point3 a, Point3 b);
Point3 operator -(Point3 a, Point3 b);
Point3 operator +(Point3 a, Point3 b);
double operator /(Point3 a, Point3 b);
// 矢量计算
struct Vector3D {
double x, y, z;
};
// 计算两点之间的距离
double distance(const Vector3D& p1, const Vector3D& p2);
// 计算点到直线的最短距离
double pointToLineDistance(const Vector3D& point, const Vector3D& linePoint, const Vector3D& lineDirection);
Vector3D operator +(const Vector3D& p1, const Vector3D& p2);
Vector3D operator -(const Vector3D& p1, const Vector3D& p2);
bool operator ==(const Vector3D& p1, const Vector3D& p2);
Vector3D operator *(const Vector3D& p, double scale);
Vector3D operator *(double scale,const Vector3D& p );
double getAngle(const Vector3D& a, const Vector3D& b);
double getCosAngle(const Vector3D& a, const Vector3D& b);
double dot(const Vector3D& p1, const Vector3D& p2);
double getlength(const Vector3D& p1);
Vector3D crossProduct(const Vector3D& a, const Vector3D& b);
/// <summary>
/// n1
/// n4 n0 n2
/// n3
/// </summary>
/// <param name="n0"></param>
/// <param name="n1"></param>
/// <param name="n2"></param>
/// <param name="n3"></param>
/// <param name="n4"></param>
/// <returns></returns>
Vector3D 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 cartesianToSpherical(const CartesianCoordinates& cartesian);
CartesianCoordinates sphericalToCartesian(const SphericalCoordinates& spherical);
double getlocalIncAngle(Vector3D& satepoint, Vector3D& landpoint, Vector3D& slopeVector);
#endif

View File

@ -1 +0,0 @@
#include "GF3PSTNClass.h"

View File

@ -1,6 +0,0 @@
#pragma once

View File

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<CudaCompile Include="GPUTool\GPUTool.cu" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="GPUTool\GPUBaseLibAPI.h" />
<CudaCompile Include="GPUTool\GPUTool.cuh" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{b8b40c54-f7fe-4809-b6fb-8bc014570d7b}</ProjectGuid>
<RootNamespace>GPUBaseLib</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 12.6.props" />
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>..\BaseCommonLibrary;..\BaseCommonLibrary\BaseTool;..\BaseCommonLibrary\ToolAbstract;.;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;GPUBASELIB_API;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp14</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<CudaCompile>
<GenerateRelocatableDeviceCode>true</GenerateRelocatableDeviceCode>
<CodeGeneration>compute_86,sm_86</CodeGeneration>
</CudaCompile>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 12.6.targets" />
</ImportGroup>
</Project>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="GPUTool">
<UniqueIdentifier>{36bccaca-86b9-48c3-97b1-376ee3555915}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<CudaCompile Include="GPUTool\GPUTool.cu">
<Filter>GPUTool</Filter>
</CudaCompile>
<CudaCompile Include="GPUTool\GPUTool.cuh">
<Filter>GPUTool</Filter>
</CudaCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GPUTool\GPUBaseLibAPI.h">
<Filter>GPUTool</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -0,0 +1,12 @@
#pragma once
#ifndef GPUBaseLib_H_
#define GPUBaseLib_H_
#ifdef GPUBASELIB_API
#define GPUBASELIBAPI __declspec(dllexport)
#else
#define GPUBASELIBAPI __declspec(dllimport)
#endif
#endif // !GPUBaseLib_H_

View File

@ -0,0 +1,534 @@
#include <iostream>
#include <memory>
#include <cmath>
#include <complex>
#include <device_launch_parameters.h>
#include <cuda_runtime.h>
#include <cublas_v2.h>
#include <cuComplex.h>
#include <chrono>
#include "BaseConstVariable.h"
#include "GPUTool.cuh"
#ifdef __CUDANVCC___
#define BLOCK_DIM 1024
#define REDUCE_SCALE 4
// 打印GPU参数
void printDeviceInfo(int deviceId) {
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, deviceId);
std::cout << "Device " << deviceId << ": " << deviceProp.name << std::endl;
std::cout << " Compute Capability: " << deviceProp.major << "." << deviceProp.minor << std::endl;
std::cout << " Total Global Memory: " << deviceProp.totalGlobalMem / (1024 * 1024) << " MB" << std::endl;
std::cout << " Shared Memory per Block: " << deviceProp.sharedMemPerBlock << " Bytes" << std::endl;
std::cout << " Registers per Block: " << deviceProp.regsPerBlock << std::endl;
std::cout << " Warp Size: " << deviceProp.warpSize << std::endl;
std::cout << " Max Threads per Block: " << deviceProp.maxThreadsPerBlock << std::endl;
std::cout << " Max Threads Dim: (" << deviceProp.maxThreadsDim[0] << ", "
<< deviceProp.maxThreadsDim[1] << ", " << deviceProp.maxThreadsDim[2] << ")" << std::endl;
std::cout << " Max Grid Size: (" << deviceProp.maxGridSize[0] << ", "
<< deviceProp.maxGridSize[1] << ", " << deviceProp.maxGridSize[2] << ")" << std::endl;
std::cout << " Multiprocessor Count: " << deviceProp.multiProcessorCount << std::endl;
std::cout << " Clock Rate: " << deviceProp.clockRate / 1000 << " MHz" << std::endl;
std::cout << " Memory Clock Rate: " << deviceProp.memoryClockRate / 1000 << " MHz" << std::endl;
std::cout << " Memory Bus Width: " << deviceProp.memoryBusWidth << " bits" << std::endl;
std::cout << " L2 Cache Size: " << deviceProp.l2CacheSize / 1024 << " KB" << std::endl;
std::cout << " Max Texture Dimensions: (" << deviceProp.maxTexture1D << ", "
<< deviceProp.maxTexture2D[0] << "x" << deviceProp.maxTexture2D[1] << ", "
<< deviceProp.maxTexture3D[0] << "x" << deviceProp.maxTexture3D[1] << "x" << deviceProp.maxTexture3D[2] << ")" << std::endl;
std::cout << " Unified Addressing: " << (deviceProp.unifiedAddressing ? "Yes" : "No") << std::endl;
std::cout << " Concurrent Kernels: " << (deviceProp.concurrentKernels ? "Yes" : "No") << std::endl;
std::cout << " ECC Enabled: " << (deviceProp.ECCEnabled ? "Yes" : "No") << std::endl;
std::cout << " PCI Bus ID: " << deviceProp.pciBusID << std::endl;
std::cout << " PCI Device ID: " << deviceProp.pciDeviceID << std::endl;
std::cout << " PCI Domain ID: " << deviceProp.pciDomainID << std::endl;
std::cout << std::endl;
}
// 定义参数
__device__ cuComplex cuCexpf(cuComplex d)
{
float factor = exp(d.x);
return make_cuComplex(factor * cos(d.y), factor * sin(d.y));
}
__device__ CUDAVector GPU_VectorAB(CUDAVector A, CUDAVector B) {
CUDAVector C;
C.x = B.x - A.x;
C.y = B.y - A.y;
C.z = B.z - A.z;
return C;
}
__device__ float GPU_VectorNorm2(CUDAVector A) {
return sqrtf(A.x * A.x + A.y * A.y + A.z * A.z);
}
__device__ float GPU_dotVector(CUDAVector A, CUDAVector B) {
return A.x * B.x + A.y * B.y + A.z * B.z;
}
__device__ float GPU_CosAngle_VectorA_VectorB(CUDAVector A, CUDAVector B) {
return GPU_dotVector(A, B) / (GPU_VectorNorm2(A) * GPU_VectorNorm2(B));
}
extern __global__ void CUDAKernel_MemsetBlock(cuComplex* data, cuComplex init0, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
data[idx] = init0;
}
}
extern __global__ void CUDAKernel_MemsetBlock(float* data, float init0, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
data[idx] = init0;
}
}
__global__ void CUDACkernel_SUM_reduce_dynamicshared(float* d_x, float* d_y, long N)
{
const int tid = threadIdx.x; // 某个block内的线程标号 index
const int bid = blockIdx.x; // 某个block在网格grid内的标号 index
const int n = bid * blockDim.x + tid; // n 是某个线程的标号 index
__shared__ float s_y[128]; // 分配共享内存空间不同的block都有共享内存变量的副本
s_y[tid] = (n < N) ? d_x[n] : 0.0; // 每个block的共享内存变量副本都用全局内存数组d_x来赋值最后一个多出来的用0
__syncthreads(); // 线程块内部直接同步
for (int offset = blockDim.x >> 1; offset > 0; offset >>= 1) // 折半
{
if (tid < offset) // 线程标号的index 不越界 折半
{
s_y[tid] += s_y[tid + offset]; // 某个block内的线程做折半规约
}
__syncthreads(); // 同步block内部的线程
}
if (tid == 0) // 某个block只做一次操作
{
d_y[bid] = s_y[0]; // 复制共享内存变量累加的结果到全局内存
}
}
__global__ void CUDA_DistanceAB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* R, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
R[idx] = sqrtf(powf(Ax[idx] - Bx[idx], 2) + powf(Ay[idx] - By[idx], 2) + powf(Az[idx] - Bz[idx], 2));
}
}
__global__ void CUDA_B_DistanceA(float* Ax, float* Ay, float* Az, float Bx, float By, float Bz, float* R, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
R[idx] = sqrtf(powf(Ax[idx] - Bx, 2) + powf(Ay[idx] - By, 2) + powf(Az[idx] - Bz, 2));
}
}
__global__ void CUDA_make_VectorA_B(float sX, float sY, float sZ, float* tX, float* tY, float* tZ, float* RstX, float* RstY, float* RstZ, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
RstX[idx] = sX - tX[idx]; // 地面->天
RstY[idx] = sY - tY[idx];
RstZ[idx] = sZ - tZ[idx];
}
}
__global__ void CUDA_Norm_Vector(float* Vx, float* Vy, float* Vz, float* R, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
R[idx] = sqrtf(powf(Vx[idx], 2) + powf(Vy[idx], 2) + powf(Vz[idx], 2));
}
}
__global__ void CUDA_cosAngle_VA_AB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* anglecos, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float tAx = Ax[idx];
float tAy = Ay[idx];
float tAz = Az[idx];
float tBx = Bx[idx];
float tBy = By[idx];
float tBz = Bz[idx];
float AR = sqrtf(powf(tAx, 2) + powf(tAy, 2) + powf(tAz, 2));
float BR = sqrtf(powf(tBx, 2) + powf(tBy, 2) + powf(tBz, 2));
float dotAB = tAx * tBx + tAy * tBy + tAz * tBz;
float result = acosf(dotAB / (AR * BR));
anglecos[idx] = result;
}
}
__global__ void CUDA_GridPoint_Linear_Interp1(float* v, float* q, float* qv, long xlen, long qlen)
{
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < qlen) {
float qx = q[idx];
// 检索循环
if (qx < 0 || qx > xlen - 1) {}
else {
long x1 = floor(qx);
long x2 = ceil(qx);
if (x1 >= 0 && x2 < xlen) {
float y1 = v[x1];
float y2 = v[x2];
float y = y1 + (y2 - y1) * (qx - x1) / (x2 - x1);
qv[idx] = y;
}
else {
}
}
}
}
extern __global__ void CUDA_D_sin(double* y, double* X, int n) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < n) {
y[idx] = sin(X[idx]);
}
}
extern __global__ void CUDA_D_cos(double* y, double* X, int n) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < n) {
y[idx] = cos(X[idx]);
}
}
extern "C" void CUDA_MemsetBlock(cuComplex* data, cuComplex init0, long len) {
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDAKernel_MemsetBlock << <numBlocks, blockSize >> > (data, init0, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDAmake_VectorA_B CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
//错误提示
extern "C" void checkCudaError(cudaError_t err, const char* msg) {
if (err != cudaSuccess) {
std::cerr << "CUDA error: " << msg << " (" << cudaGetErrorString(err) << ")" << std::endl;
exit(EXIT_FAILURE);
}
}
// 主机参数内存声明
extern "C" void* mallocCUDAHost(long memsize) {
void* ptr;
cudaMallocHost(&ptr, memsize);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("mallocCUDAHost CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
return ptr;
}
// 主机参数内存释放
extern "C" void FreeCUDAHost(void* ptr) {
cudaFreeHost(ptr);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("FreeCUDAHost CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
// GPU参数内存声明
extern "C" void* mallocCUDADevice(long memsize) {
void* ptr;
cudaMalloc(&ptr, memsize);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("mallocCUDADevice CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
return ptr;
}
// GPU参数内存释放
extern "C" void FreeCUDADevice(void* ptr) {
cudaFree(ptr);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("FreeCUDADevice CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
// GPU 内存数据转移
extern "C" void HostToDevice(void* hostptr, void* deviceptr, long memsize) {
cudaMemcpy(deviceptr, hostptr, memsize, cudaMemcpyHostToDevice);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("HostToDevice CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void DeviceToHost(void* hostptr, void* deviceptr, long memsize) {
cudaMemcpy(hostptr, deviceptr, memsize, cudaMemcpyDeviceToHost);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("DeviceToHost CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
void DeviceToDevice(void* s_deviceptr, void* t_deviceptr, long memsize)
{
cudaMemcpy(t_deviceptr, s_deviceptr, memsize, cudaMemcpyDeviceToDevice);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("DeviceToDevice CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
// 基础运算函数
extern "C" void CUDAdistanceAB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* R, long len) {
// 设置 CUDA 核函数的网格和块的尺寸
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_DistanceAB << <numBlocks, blockSize >> > (Ax, Ay, Az, Bx, By, Bz, R, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDAdistanceAB CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDABdistanceAs(float* Ax, float* Ay, float* Az, float Bx, float By, float Bz, float* R, long len) {
// 设置 CUDA 核函数的网格和块的尺寸
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_B_DistanceA << <numBlocks, blockSize >> > (Ax, Ay, Az, Bx, By, Bz, R, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDABdistanceAs CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDAmake_VectorA_B(float sX, float sY, float sZ, float* tX, float* tY, float* tZ, float* RstX, float* RstY, float* RstZ, long len) {
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_make_VectorA_B << <numBlocks, blockSize >> > (sX, sY, sZ, tX, tY, tZ, RstX, RstY, RstZ, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDAmake_VectorA_B CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDANorm_Vector(float* Vx, float* Vy, float* Vz, float* R, long len) {
// 设置 CUDA 核函数的网格和块的尺寸
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_Norm_Vector << <numBlocks, blockSize >> > (Vx, Vy, Vz, R, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDANorm_Vector CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDAcosAngle_VA_AB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* anglecos, long len) {
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_cosAngle_VA_AB << <numBlocks, blockSize >> > (Ax, Ay, Az, Bx, By, Bz, anglecos, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDAcosAngle_VA_AB CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDAGridPointLinearInterp1(float* v, float* q, float* qv, long xlen, long qlen)
{
int blockSize = 256; // 每个块的线程数
int numBlocks = (qlen + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_GridPoint_Linear_Interp1 << <numBlocks, blockSize >> > (v, q, qv, xlen, qlen);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDALinearInterp1 CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDADSin(double* y, double* X, int n)
{
// 计算 sin(temp) 并存储在 d_temp 中
int blockSize = 256;
int numBlocks = (n + blockSize - 1) / blockSize;
CUDA_D_sin << <numBlocks, blockSize >> > (y, X, n);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("sin CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDADCos(double* y, double* X, int n)
{
// 计算 sin(temp) 并存储在 d_temp 中
int blockSize = 256;
int numBlocks = (n + blockSize - 1) / blockSize;
CUDA_D_cos << <numBlocks, blockSize >> > (y, X, n);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("sin CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
long NextBlockPad(long num, long blocksize)
{
return ((num + blocksize - 1) / blocksize) * blocksize;
}
void PrintLasterError(const char* s)
{
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("%s: %s\n", s, cudaGetErrorString(err));
exit(2);
}
}
#endif
extern "C" float CUDA_SUM(float* d_x, long N)
{
long NUM_REPEATS = 100;
int grid_size = (N + BLOCK_SIZE - 1) / BLOCK_SIZE;
const int ymem = sizeof(float) * grid_size;
const int smem = sizeof(float) * BLOCK_SIZE;
float* d_y = (float*)mallocCUDADevice(ymem);
float* h_y = (float*)mallocCUDAHost(ymem);
CUDACkernel_SUM_reduce_dynamicshared << <grid_size, BLOCK_SIZE, smem >> > (d_x, d_y, N);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDALinearInterp1 CUDA Error: %s\n", cudaGetErrorString(err));
exit(2);
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
DeviceToHost(h_y, d_y, ymem);
float result = 0.0;
for (int n = 0; n < grid_size; ++n)
{
result += h_y[n];
}
FreeCUDAHost(h_y);
FreeCUDADevice(d_y);
return result;
}

View File

@ -0,0 +1,108 @@
#ifndef _GPUTOOL_H_
#define _GPUTOOL_H_
#include "GPUBaseLibAPI.h"
#include "BaseConstVariable.h"
#ifdef __CUDANVCC___
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
#include <cublas_v2.h>
#include <cuComplex.h>
#define __CUDADEBUG__
#define CUDAMEMORY Memory1MB*100
#define LAMP_CUDA_PI 3.141592653589793238462643383279
// SHAREMEMORY_FLOAT_HALF_STEP * BLOCK_SIZE = SHAREMEMORY_FLOAT_HALF
#define BLOCK_SIZE 256
#define SHAREMEMORY_BYTE 49152
#define SHAREMEMORY_FLOAT_HALF 6144
#define SHAREMEMORY_FLOAT_HALF_STEP 24
enum LAMPGPUDATETYPE {
LAMP_LONG,
LAMP_FLOAT,
LAMP_COMPLEXFLOAT
};
extern "C" struct CUDAVector {
float x;
float y;
float z;
};
extern "C" struct CUDAVectorEllipsoidal {
float theta;
float phi;
float Rho;
};
extern "C" struct CUDAComplex {
float x;
float y;
};
//// 定义设备函数
//extern __device__ cuComplex cuCexpf(cuComplex x);
//extern __device__ CUDAVector GPU_VectorAB(CUDAVector A, CUDAVector B);
//extern __device__ float GPU_VectorNorm2(CUDAVector A);
//extern __device__ float GPU_dotVector(CUDAVector A, CUDAVector B);
//extern __device__ float GPU_CosAngle_VectorA_VectorB(CUDAVector A, CUDAVector B);
//
//// 定义全局函数
//extern __global__ void CUDA_DistanceAB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* R, long len);
//extern __global__ void CUDA_B_DistanceA(float* Ax, float* Ay, float* Az, float Bx, float By, float Bz, float* R, long len);
//extern __global__ void CUDA_make_VectorA_B(float sX, float sY, float sZ, float* tX, float* tY, float* tZ, float* RstX, float* RstY, float* RstZ, long len);
//extern __global__ void CUDA_Norm_Vector(float* Vx, float* Vy, float* Vz, float* R, long len);
//extern __global__ void CUDA_cosAngle_VA_AB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* anglecos, long len);
//extern __global__ void CUDA_GridPoint_Linear_Interp1(float* v, float* q, float* qv, long xlen, long qlen);
//extern __global__ void CUDA_D_sin(double* y, double* X, int n);
//extern __global__ void CUDA_D_cos(double* y, double* X, int n);
//extern __global__ void CUDAKernel_MemsetBlock(cuComplex* data, cuComplex init0, long len);
//
//extern __global__ void CUDAKernel_MemsetBlock(float* data, float init0, long len);
// 打印GPU参数
extern "C" GPUBASELIBAPI void printDeviceInfo(int deviceId);
// 误差处理函数
extern "C" GPUBASELIBAPI void checkCudaError(cudaError_t err, const char* msg);
// GPU 内存函数
extern "C" GPUBASELIBAPI void* mallocCUDAHost(long memsize); // 主机内存声明
extern "C" GPUBASELIBAPI void FreeCUDAHost(void* ptr);
extern "C" GPUBASELIBAPI void* mallocCUDADevice(long memsize); // GPU内存声明
extern "C" GPUBASELIBAPI void FreeCUDADevice(void* ptr);
extern "C" GPUBASELIBAPI void HostToDevice(void* hostptr, void* deviceptr, long memsize);//GPU 内存数据转移 设备 -> GPU
extern "C" GPUBASELIBAPI void DeviceToHost(void* hostptr, void* deviceptr, long memsize);//GPU 内存数据转移 GPU -> 设备
extern "C" GPUBASELIBAPI void DeviceToDevice(void* s_deviceptr, void* t_deviceptr, long memsize);//GPU 内存数据转移 GPU -> 设备
extern "C" GPUBASELIBAPI void CUDA_MemsetBlock(cuComplex* data, cuComplex init0, long len);
// 矢量基础运算函数
extern "C" GPUBASELIBAPI void CUDAdistanceAB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* R, long member);
extern "C" GPUBASELIBAPI void CUDABdistanceAs(float* Ax, float* Ay, float* Az, float Bx, float By, float Bz, float* R, long member);
extern "C" GPUBASELIBAPI void CUDAmake_VectorA_B(float sX, float sY, float sZ, float* tX, float* tY, float* tZ, float* RstX, float* RstY, float* RstZ, long member);
extern "C" GPUBASELIBAPI void CUDANorm_Vector(float* Vx, float* Vy, float* Vz, float* R, long member);
extern "C" GPUBASELIBAPI void CUDAcosAngle_VA_AB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* anglecos, long len);
// 常见插值算法
extern "C" GPUBASELIBAPI void CUDAGridPointLinearInterp1(float* v, float* q, float* qv, long xlen, long qlen);
extern "C" GPUBASELIBAPI void CUDADSin(double* y, double* X, int n);
extern "C" GPUBASELIBAPI void CUDADCos(double* y, double* X, int n);
// 估算分块整数
extern "C" GPUBASELIBAPI long NextBlockPad(long num, long blocksize);
extern "C" GPUBASELIBAPI void PrintLasterError(const char* s);
#endif
#endif

View File

@ -0,0 +1,10 @@
#include "LAMPDataProcessEXE.h"
LAMPDataProcessEXE::LAMPDataProcessEXE(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
}
LAMPDataProcessEXE::~LAMPDataProcessEXE()
{}

View File

@ -0,0 +1,16 @@
#pragma once
#include <QtWidgets/QMainWindow>
#include "ui_LAMPDataProcessEXE.h"
class LAMPDataProcessEXE : public QMainWindow
{
Q_OBJECT
public:
LAMPDataProcessEXE(QWidget *parent = nullptr);
~LAMPDataProcessEXE();
private:
Ui::LAMPDataProcessEXEClass ui;
};

View File

@ -0,0 +1,4 @@
<RCC>
<qresource prefix="LAMPDataProcessEXE">
</qresource>
</RCC>

View File

@ -0,0 +1,28 @@
<UI version="4.0" >
<class>LAMPDataProcessEXEClass</class>
<widget class="QMainWindow" name="LAMPDataProcessEXEClass" >
<property name="objectName" >
<string notr="true">LAMPDataProcessEXEClass</string>
</property>
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle" >
<string>LAMPDataProcessEXE</string>
</property> <widget class="QMenuBar" name="menuBar" />
<widget class="QToolBar" name="mainToolBar" />
<widget class="QWidget" name="centralWidget" />
<widget class="QStatusBar" name="statusBar" />
</widget>
<layoutDefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<resources>
<include location="LAMPDataProcessEXE.qrc"/>
</resources>
<connections/>
</UI>

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{4E6E79A3-048C-4FB4-BBB0-43C518A3E6D4}</ProjectGuid>
<Keyword>QtVS_v304</Keyword>
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">10.0</WindowsTargetPlatformVersion>
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
<Import Project="$(QtMsBuild)\qt_defaults.props" />
</ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
<QtInstall>tools_qt5</QtInstall>
<QtModules>core;gui;widgets</QtModules>
<QtBuildConfig>debug</QtBuildConfig>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
<QtInstall>tools_qt5</QtInstall>
<QtModules>core;gui;widgets</QtModules>
<QtBuildConfig>release</QtBuildConfig>
</PropertyGroup>
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
</Target>
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="Shared" />
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<IncludePath>..\BaseCommonLibrary;..\BaseCommonLibrary\BaseTool;..\BaseCommonLibrary\ToolAbstract;..\GPUBaseLib\GPUTool;..\LAMPSARProcessProgram;..\LAMPMainWidget;..\RasterMainWidgetGUI;..\RasterMainWidgetGUI\RasterMainWidget;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<CopyLocalProjectReference>true</CopyLocalProjectReference>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<LanguageStandard>stdcpp14</LanguageStandard>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<QtRcc Include="LAMPDataProcessEXE.qrc" />
<QtUic Include="LAMPDataProcessEXE.ui" />
<QtMoc Include="LAMPDataProcessEXE.h" />
<ClCompile Include="LAMPDataProcessEXE.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BaseCommonLibrary\BaseCommonLibrary.vcxproj">
<Project>{872ecd6f-30e3-4a1b-b17c-15e87d373ff6}</Project>
</ProjectReference>
<ProjectReference Include="..\GPUBaseLib\GPUBaseLib.vcxproj">
<Project>{b8b40c54-f7fe-4809-b6fb-8bc014570d7b}</Project>
</ProjectReference>
<ProjectReference Include="..\LAMPSARProcessProgram\RasterProcessTool.vcxproj">
<Project>{7ef67daa-dbc0-4b7f-80e8-11b4d2cb7ec2}</Project>
</ProjectReference>
<ProjectReference Include="..\RasterMainWidgetGUI\RasterMainWidgetGUI.vcxproj">
<Project>{e56b3878-a3dc-41a4-abf3-b628816d0d64}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
</ImportGroup>
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Form Files">
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
<Extensions>ui</Extensions>
</Filter>
<Filter Include="Translation Files">
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
<Extensions>ts</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<QtRcc Include="LAMPDataProcessEXE.qrc">
<Filter>Resource Files</Filter>
</QtRcc>
<QtUic Include="LAMPDataProcessEXE.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtMoc Include="LAMPDataProcessEXE.h">
<Filter>Header Files</Filter>
</QtMoc>
<ClCompile Include="LAMPDataProcessEXE.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

Binary file not shown.

View File

@ -0,0 +1,50 @@
#include "LAMPDataProcessEXE.h"
#include <QtWidgets/QApplication>
#include <QCoreApplication>
#include <QDebug>
#include <QFile>
#include <QTextStream>
#include <QDateTime>
#include "LAMPMainWidgetRunProgram.h"
#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:
ts << dateTime << " Debug: " << localMsg.constData() << " (" << file << ":" << context.line << ", " << function << ")\n";
break;
case QtInfoMsg:
ts << dateTime << " Info: " << localMsg.constData() << " (" << file << ":" << context.line << ", " << function << ")\n";
break;
case QtWarningMsg:
ts << dateTime << " Warning: " << localMsg.constData() << " (" << file << ":" << context.line << ", " << function << ")\n";
break;
case QtCriticalMsg:
ts << dateTime << " Critical: " << localMsg.constData() << " (" << file << ":" << context.line << ", " << function << ")\n";
break;
case QtFatalMsg:
ts << dateTime << " Fatal: " << localMsg.constData() << " (" << file << ":" << context.line << ", " << function << ")\n";
abort();
}
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
RasterMainWidgetRun();
return a.exec();
}

View File

@ -0,0 +1,12 @@
#include "QApplicationSettingManager.h"
#include "ui_QApplicationSettingManager.h"
QApplicationSettingManager::QApplicationSettingManager(QWidget *parent)
: QDialog(parent),ui(new Ui::QApplicationSettingManagerClass)
{
ui->setupUi(this);
}
QApplicationSettingManager::~QApplicationSettingManager()
{}

View File

@ -0,0 +1,19 @@
#pragma once
#include "RasterProcessToolWidgetAPI.h"
#include <QDialog>
namespace Ui {
class QApplicationSettingManagerClass;
}
class RASTERPROCESSTOOLWIDGET_EXPORT QApplicationSettingManager : public QDialog
{
Q_OBJECT
public:
QApplicationSettingManager(QWidget *parent = nullptr);
~QApplicationSettingManager();
private:
Ui::QApplicationSettingManagerClass* ui;
};

View File

@ -0,0 +1,22 @@
<UI version="4.0" >
<class>QApplicationSettingManagerClass</class>
<widget class="QDialog" name="QApplicationSettingManagerClass" >
<property name="objectName" >
<string notr="true">QApplicationSettingManagerClass</string>
</property>
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle" >
<string>QApplicationSettingManager</string>
</property>$centralwidget$
</widget>
<layoutDefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<connections/>
</UI>

View File

@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/RasterProcessTool">
<file alias="toolicon.png">resource/toolicon.png</file>
<file alias="toolboxIcon">resource/toolboxIcon.png</file>
</qresource>
</RCC>

View File

@ -0,0 +1,146 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.35122.118
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RasterProcessToolWidget", "RasterProcessTool.vcxproj", "{7EF67DAA-DBC0-4B7F-80E8-11B4D2CB7EC2}"
ProjectSection(ProjectDependencies) = postProject
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B} = {B8B40C54-F7FE-4809-B6FB-8BC014570D7B}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseCommonLibrary", "..\BaseCommonLibrary\BaseCommonLibrary.vcxproj", "{872ECD6F-30E3-4A1B-B17C-15E87D373FF6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseToolbox", "..\Toolbox\BaseToolbox\BaseToolbox.vcxproj", "{070C157E-3C30-4E2B-A80C-CBC7B74DF03F}"
ProjectSection(ProjectDependencies) = postProject
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B} = {B8B40C54-F7FE-4809-B6FB-8BC014570D7B}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LAMPScatterTool", "..\Toolbox\LAMPScatterTool\LAMPScatterTool.vcxproj", "{D603A623-132D-4304-AB03-638FC438F084}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimulationSARTool", "..\Toolbox\SimulationSARTool\SimulationSARTool.vcxproj", "{ED06DFCD-4B9F-41F7-8F25-1823C2398142}"
ProjectSection(ProjectDependencies) = postProject
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B} = {B8B40C54-F7FE-4809-B6FB-8BC014570D7B}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ToolBox", "ToolBox", "{41B1F23D-9119-47A7-B102-34022AF83CDA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BaseLib", "BaseLib", "{2768F9D6-D410-4E88-A479-8336DAF97072}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageshowTool", "..\Toolbox\ImageshowTool\ImageshowTool.vcxproj", "{8C8CA066-A93A-4098-9A46-B855EFEAADF2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ALLRelease", "..\ALLRelease\ALLRelease.vcxproj", "{8A71D19D-9AC6-42E9-81EC-9E82AF8075B8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MainWidget", "MainWidget", "{6505E2BA-06A2-447B-BC85-8CF1A81359BC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LAMPDataProcessEXE", "..\LAMPDataProcessEXE\LAMPDataProcessEXE.vcxproj", "{4E6E79A3-048C-4FB4-BBB0-43C518A3E6D4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GPUBaseLib", "..\GPUBaseLib\GPUBaseLib.vcxproj", "{B8B40C54-F7FE-4809-B6FB-8BC014570D7B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RasterMainWidgetGUI", "..\RasterMainWidgetGUI\RasterMainWidgetGUI.vcxproj", "{E56B3878-A3DC-41A4-ABF3-B628816D0D64}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7EF67DAA-DBC0-4B7F-80E8-11B4D2CB7EC2}.Debug|x64.ActiveCfg = Debug|x64
{7EF67DAA-DBC0-4B7F-80E8-11B4D2CB7EC2}.Debug|x64.Build.0 = Debug|x64
{7EF67DAA-DBC0-4B7F-80E8-11B4D2CB7EC2}.Debug|x86.ActiveCfg = Debug|x64
{7EF67DAA-DBC0-4B7F-80E8-11B4D2CB7EC2}.Debug|x86.Build.0 = Debug|x64
{7EF67DAA-DBC0-4B7F-80E8-11B4D2CB7EC2}.Release|x64.ActiveCfg = Release|x64
{7EF67DAA-DBC0-4B7F-80E8-11B4D2CB7EC2}.Release|x64.Build.0 = Release|x64
{7EF67DAA-DBC0-4B7F-80E8-11B4D2CB7EC2}.Release|x86.ActiveCfg = Release|x64
{7EF67DAA-DBC0-4B7F-80E8-11B4D2CB7EC2}.Release|x86.Build.0 = Release|x64
{872ECD6F-30E3-4A1B-B17C-15E87D373FF6}.Debug|x64.ActiveCfg = Debug|x64
{872ECD6F-30E3-4A1B-B17C-15E87D373FF6}.Debug|x64.Build.0 = Debug|x64
{872ECD6F-30E3-4A1B-B17C-15E87D373FF6}.Debug|x86.ActiveCfg = Debug|Win32
{872ECD6F-30E3-4A1B-B17C-15E87D373FF6}.Debug|x86.Build.0 = Debug|Win32
{872ECD6F-30E3-4A1B-B17C-15E87D373FF6}.Release|x64.ActiveCfg = Release|x64
{872ECD6F-30E3-4A1B-B17C-15E87D373FF6}.Release|x64.Build.0 = Release|x64
{872ECD6F-30E3-4A1B-B17C-15E87D373FF6}.Release|x86.ActiveCfg = Release|Win32
{872ECD6F-30E3-4A1B-B17C-15E87D373FF6}.Release|x86.Build.0 = Release|Win32
{070C157E-3C30-4E2B-A80C-CBC7B74DF03F}.Debug|x64.ActiveCfg = Debug|x64
{070C157E-3C30-4E2B-A80C-CBC7B74DF03F}.Debug|x64.Build.0 = Debug|x64
{070C157E-3C30-4E2B-A80C-CBC7B74DF03F}.Debug|x86.ActiveCfg = Debug|x64
{070C157E-3C30-4E2B-A80C-CBC7B74DF03F}.Debug|x86.Build.0 = Debug|x64
{070C157E-3C30-4E2B-A80C-CBC7B74DF03F}.Release|x64.ActiveCfg = Release|x64
{070C157E-3C30-4E2B-A80C-CBC7B74DF03F}.Release|x64.Build.0 = Release|x64
{070C157E-3C30-4E2B-A80C-CBC7B74DF03F}.Release|x86.ActiveCfg = Release|x64
{070C157E-3C30-4E2B-A80C-CBC7B74DF03F}.Release|x86.Build.0 = Release|x64
{D603A623-132D-4304-AB03-638FC438F084}.Debug|x64.ActiveCfg = Debug|x64
{D603A623-132D-4304-AB03-638FC438F084}.Debug|x64.Build.0 = Debug|x64
{D603A623-132D-4304-AB03-638FC438F084}.Debug|x86.ActiveCfg = Debug|x64
{D603A623-132D-4304-AB03-638FC438F084}.Debug|x86.Build.0 = Debug|x64
{D603A623-132D-4304-AB03-638FC438F084}.Release|x64.ActiveCfg = Release|x64
{D603A623-132D-4304-AB03-638FC438F084}.Release|x64.Build.0 = Release|x64
{D603A623-132D-4304-AB03-638FC438F084}.Release|x86.ActiveCfg = Release|x64
{D603A623-132D-4304-AB03-638FC438F084}.Release|x86.Build.0 = Release|x64
{ED06DFCD-4B9F-41F7-8F25-1823C2398142}.Debug|x64.ActiveCfg = Debug|x64
{ED06DFCD-4B9F-41F7-8F25-1823C2398142}.Debug|x64.Build.0 = Debug|x64
{ED06DFCD-4B9F-41F7-8F25-1823C2398142}.Debug|x86.ActiveCfg = Debug|x64
{ED06DFCD-4B9F-41F7-8F25-1823C2398142}.Debug|x86.Build.0 = Debug|x64
{ED06DFCD-4B9F-41F7-8F25-1823C2398142}.Release|x64.ActiveCfg = Release|x64
{ED06DFCD-4B9F-41F7-8F25-1823C2398142}.Release|x64.Build.0 = Release|x64
{ED06DFCD-4B9F-41F7-8F25-1823C2398142}.Release|x86.ActiveCfg = Release|x64
{ED06DFCD-4B9F-41F7-8F25-1823C2398142}.Release|x86.Build.0 = Release|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Debug|x64.ActiveCfg = Debug|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Debug|x64.Build.0 = Debug|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Debug|x86.ActiveCfg = Debug|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Debug|x86.Build.0 = Debug|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x64.ActiveCfg = Release|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x64.Build.0 = Release|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x86.ActiveCfg = Release|x64
{8C8CA066-A93A-4098-9A46-B855EFEAADF2}.Release|x86.Build.0 = Release|x64
{8A71D19D-9AC6-42E9-81EC-9E82AF8075B8}.Debug|x64.ActiveCfg = Debug|x64
{8A71D19D-9AC6-42E9-81EC-9E82AF8075B8}.Debug|x64.Build.0 = Debug|x64
{8A71D19D-9AC6-42E9-81EC-9E82AF8075B8}.Debug|x86.ActiveCfg = Debug|Win32
{8A71D19D-9AC6-42E9-81EC-9E82AF8075B8}.Debug|x86.Build.0 = Debug|Win32
{8A71D19D-9AC6-42E9-81EC-9E82AF8075B8}.Release|x64.ActiveCfg = Release|x64
{8A71D19D-9AC6-42E9-81EC-9E82AF8075B8}.Release|x64.Build.0 = Release|x64
{8A71D19D-9AC6-42E9-81EC-9E82AF8075B8}.Release|x86.ActiveCfg = Release|Win32
{8A71D19D-9AC6-42E9-81EC-9E82AF8075B8}.Release|x86.Build.0 = Release|Win32
{4E6E79A3-048C-4FB4-BBB0-43C518A3E6D4}.Debug|x64.ActiveCfg = Debug|x64
{4E6E79A3-048C-4FB4-BBB0-43C518A3E6D4}.Debug|x64.Build.0 = Debug|x64
{4E6E79A3-048C-4FB4-BBB0-43C518A3E6D4}.Debug|x86.ActiveCfg = Debug|x64
{4E6E79A3-048C-4FB4-BBB0-43C518A3E6D4}.Debug|x86.Build.0 = Debug|x64
{4E6E79A3-048C-4FB4-BBB0-43C518A3E6D4}.Release|x64.ActiveCfg = Release|x64
{4E6E79A3-048C-4FB4-BBB0-43C518A3E6D4}.Release|x64.Build.0 = Release|x64
{4E6E79A3-048C-4FB4-BBB0-43C518A3E6D4}.Release|x86.ActiveCfg = Release|x64
{4E6E79A3-048C-4FB4-BBB0-43C518A3E6D4}.Release|x86.Build.0 = Release|x64
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B}.Debug|x64.ActiveCfg = Debug|x64
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B}.Debug|x64.Build.0 = Debug|x64
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B}.Debug|x86.ActiveCfg = Debug|Win32
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B}.Debug|x86.Build.0 = Debug|Win32
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B}.Release|x64.ActiveCfg = Release|x64
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B}.Release|x64.Build.0 = Release|x64
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B}.Release|x86.ActiveCfg = Release|Win32
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B}.Release|x86.Build.0 = Release|Win32
{E56B3878-A3DC-41A4-ABF3-B628816D0D64}.Debug|x64.ActiveCfg = Debug|x64
{E56B3878-A3DC-41A4-ABF3-B628816D0D64}.Debug|x64.Build.0 = Debug|x64
{E56B3878-A3DC-41A4-ABF3-B628816D0D64}.Debug|x86.ActiveCfg = Debug|x64
{E56B3878-A3DC-41A4-ABF3-B628816D0D64}.Debug|x86.Build.0 = Debug|x64
{E56B3878-A3DC-41A4-ABF3-B628816D0D64}.Release|x64.ActiveCfg = Release|x64
{E56B3878-A3DC-41A4-ABF3-B628816D0D64}.Release|x64.Build.0 = Release|x64
{E56B3878-A3DC-41A4-ABF3-B628816D0D64}.Release|x86.ActiveCfg = Release|x64
{E56B3878-A3DC-41A4-ABF3-B628816D0D64}.Release|x86.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{7EF67DAA-DBC0-4B7F-80E8-11B4D2CB7EC2} = {6505E2BA-06A2-447B-BC85-8CF1A81359BC}
{872ECD6F-30E3-4A1B-B17C-15E87D373FF6} = {2768F9D6-D410-4E88-A479-8336DAF97072}
{070C157E-3C30-4E2B-A80C-CBC7B74DF03F} = {41B1F23D-9119-47A7-B102-34022AF83CDA}
{D603A623-132D-4304-AB03-638FC438F084} = {41B1F23D-9119-47A7-B102-34022AF83CDA}
{ED06DFCD-4B9F-41F7-8F25-1823C2398142} = {41B1F23D-9119-47A7-B102-34022AF83CDA}
{8C8CA066-A93A-4098-9A46-B855EFEAADF2} = {41B1F23D-9119-47A7-B102-34022AF83CDA}
{B8B40C54-F7FE-4809-B6FB-8BC014570D7B} = {2768F9D6-D410-4E88-A479-8336DAF97072}
{E56B3878-A3DC-41A4-ABF3-B628816D0D64} = {6505E2BA-06A2-447B-BC85-8CF1A81359BC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {179F0A62-C631-4667-AD03-3780ADE09F41}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7EF67DAA-DBC0-4B7F-80E8-11B4D2CB7EC2}</ProjectGuid>
<Keyword>QtVS_v304</Keyword>
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">10.0</WindowsTargetPlatformVersion>
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
<ProjectName>RasterProcessToolWidget</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseInteloneMKL>Parallel</UseInteloneMKL>
<UseILP64Interfaces1A>true</UseILP64Interfaces1A>
<UseIntelMPI>false</UseIntelMPI>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
<Import Project="$(QtMsBuild)\qt_defaults.props" />
</ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
<QtInstall>tools_qt5</QtInstall>
<QtModules>core;gui;widgets</QtModules>
<QtBuildConfig>debug</QtBuildConfig>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
<QtInstall>tools_qt5</QtInstall>
<QtModules>core;xml;sql;gui;help;xmlpatterns;widgets;location;bluetooth;printsupport;dbus;charts;datavisualization</QtModules>
<QtBuildConfig>release</QtBuildConfig>
</PropertyGroup>
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
</Target>
<ImportGroup Label="ExtensionSettings">
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 12.6.props" />
</ImportGroup>
<ImportGroup Label="Shared" />
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<IncludePath>.\SimulationSAR;.\GF3ProcessToolbox;.\BaseTool;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<IncludePath>..\BaseCommonLibrary;..\BaseCommonLibrary\BaseTool;..\GPUBaseLib\GPUTool;..\BaseCommonLibrary\ToolAbstract;$(oneMKLIncludeDir);$(IncludePath)</IncludePath>
<ReferencePath>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\lib\x64;$(ReferencePath)</ReferencePath>
<CopyLocalProjectReference>true</CopyLocalProjectReference>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>RASTERPROCESSTOOLWIDGET_LIB;_CRT_SECURE_NO_WARNINGS;_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<OpenMPSupport>true</OpenMPSupport>
<Optimization>Disabled</Optimization>
<WholeProgramOptimization>false</WholeProgramOptimization>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<LanguageStandard>stdcpp14</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
<LargeAddressAware>true</LargeAddressAware>
<AdditionalDependencies>cublas.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<CudaCompile>
<CodeGeneration>compute_86,sm_86</CodeGeneration>
<GenerateRelocatableDeviceCode>true</GenerateRelocatableDeviceCode>
</CudaCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="QApplicationSettingManager.cpp" />
<QtRcc Include="RasterProcessTool.qrc" />
<QtUic Include="QApplicationSettingManager.ui" />
<QtUic Include="ToolBoxWidget.ui" />
<QtMoc Include="ToolBoxWidget.h" />
<ClCompile Include="ToolBoxWidget.cpp" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="QApplicationSettingManager.h" />
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BaseCommonLibrary\BaseCommonLibrary.vcxproj">
<Project>{872ecd6f-30e3-4a1b-b17c-15e87d373ff6}</Project>
</ProjectReference>
<ProjectReference Include="..\GPUBaseLib\GPUBaseLib.vcxproj">
<Project>{b8b40c54-f7fe-4809-b6fb-8bc014570d7b}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClInclude Include="RasterProcessToolWidgetAPI.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
</ImportGroup>
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 12.6.targets" />
</ImportGroup>
</Project>

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Form Files">
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
<Extensions>ui</Extensions>
</Filter>
<Filter Include="Translation Files">
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
<Extensions>ts</Extensions>
</Filter>
<Filter Include="ToolBox">
<UniqueIdentifier>{3f0381bd-7381-4873-8654-e44acf0acaa1}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<QtRcc Include="RasterProcessTool.qrc">
<Filter>Resource Files</Filter>
</QtRcc>
<QtUic Include="ToolBoxWidget.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtMoc Include="ToolBoxWidget.h">
<Filter>Header Files</Filter>
</QtMoc>
<ClCompile Include="ToolBoxWidget.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="QApplicationSettingManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="QApplicationSettingManager.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
</ItemGroup>
<ItemGroup>
<QtUic Include="QApplicationSettingManager.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<ClInclude Include="RasterProcessToolWidgetAPI.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -0,0 +1,11 @@
#pragma once
#ifndef RASTERPROCESSTOOLWIDGET_H_
#define RASTERPROCESSTOOLWIDGET_H_
#include <QtCore/qglobal.h>
# if defined(RASTERPROCESSTOOLWIDGET_LIB)
# define RASTERPROCESSTOOLWIDGET_EXPORT Q_DECL_EXPORT
# else
# define RASTERPROCESSTOOLWIDGET_EXPORT Q_DECL_IMPORT
# endif
#endif

View File

@ -0,0 +1,177 @@
#include <ui_PluginManageDialog.h>
#include "PluginManageDialog.h"
#include "MainWindow/MainWindow.h"
#include "PluginManager.h"
#include "Settings/BusAPI.h"
#include <QDir>
#include <QMessageBox>
#include <QDebug>
namespace Plugins
{
PluginManageDialog::PluginManageDialog(GUI::MainWindow *mw, PluginManager *m)
: _manager(m), _mainWindow(mw)
{
_ui = new Ui::PluginManageDialog;
_ui->setupUi(this);
_ui->availableList->setSelectionMode(QAbstractItemView::ExtendedSelection);
_ui->selectedList->setSelectionMode(QAbstractItemView::ExtendedSelection);
this->init();
connect(this, SIGNAL(updateMainWindowInteface()), mw, SIGNAL(updateInterfaces()));
}
PluginManageDialog::~PluginManageDialog()
{
if (_ui != nullptr)
delete _ui;
}
void PluginManageDialog::init()
{
QStringList insplugs = Setting::BusAPI::instance()->getPlugins();
for (int i = 0; i < insplugs.size(); ++i)
{
QString name = insplugs.at(i);
this->appendItemToSelectedList(name);
}
QString suffix = "dll";
QString pre = "plugin";
#ifdef Q_OS_LINUX
suffix = "so";
pre = "libplugin";
#endif
const QString plugdir = QApplication::applicationDirPath() + "/plugins/";
QDir dir(plugdir);
dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
QFileInfoList list = dir.entryInfoList();
for (int i = 0; i < list.size(); ++i)
{
QFileInfo fileInfo = list.at(i);
QString plugpath = fileInfo.absoluteFilePath();
QString pluginname = fileInfo.fileName();
if (insplugs.contains(pluginname))
continue;
if (!pluginname.toLower().startsWith(pre))
continue;
if (!pluginname.toLower().endsWith(suffix))
continue;
this->appendItemToAvailableList(pluginname);
}
}
void PluginManageDialog::on_addButton_clicked()
{
// int iSelectListItemNumber = _ui->selectedList->count();
QList<QListWidgetItem *> itemList = _ui->availableList->selectedItems();
const int n = itemList.size();
for (int i = 0; i < n; ++i)
{
QListWidgetItem *availitem = itemList.at(i);
const int row = _ui->availableList->row(availitem);
QListWidgetItem *selectitem = new QListWidgetItem(QIcon("://QUI/icon/Plugin_ins.png"), availitem->text());
_ui->selectedList->addItem(selectitem);
_ui->availableList->takeItem(row);
}
}
void PluginManageDialog::on_removeButton_clicked()
{
QList<QListWidgetItem *> itemList = _ui->selectedList->selectedItems();
const int n = itemList.size();
for (int i = 0; i < n; ++i)
{
QListWidgetItem *selectitem = itemList.at(i);
const int row = _ui->selectedList->row(selectitem);
QListWidgetItem *availitem = new QListWidgetItem(QIcon("://QUI/icon/Plugin_ava.png"), selectitem->text());
_ui->availableList->addItem(availitem);
_ui->selectedList->takeItem(row);
}
}
void PluginManageDialog::appendItemToAvailableList(QString name)
{
QListWidgetItem *item = new QListWidgetItem(QIcon("://QUI/icon/Plugin_ava.png"), name);
_ui->availableList->addItem(item);
}
void PluginManageDialog::appendItemToSelectedList(QString name)
{
QListWidgetItem *item = new QListWidgetItem(QIcon("://QUI/icon/Plugin_ins.png"), name);
_ui->selectedList->addItem(item);
}
QStringList PluginManageDialog::getSelectedItemNames()
{
QStringList names;
const int n = _ui->selectedList->count();
for (int i = 0; i < n; ++i)
{
QListWidgetItem *item = _ui->selectedList->item(i);
const QString text = item->text();
names.append(text);
}
return names;
}
void PluginManageDialog::accept()
{
QStringList selectedNames = this->getSelectedItemNames();
QStringList installedNames = Setting::BusAPI::instance()->getPlugins();
QStringList commonList;
for (QString name : installedNames)
{
if (selectedNames.contains(name))
commonList.append(name);
}
QStringList ins = commonList;
QStringList failres;
for (QString name : installedNames)
{
if (!commonList.contains(name))
{
bool ok = _manager->releasePlugin(name);
{
if (!ok)
{
failres.append(name);
ins.append(name);
}
}
}
}
QStringList failins;
for (QString name : selectedNames)
{
qDebug()<< QString("check loading plugin :")+name;
if (!commonList.contains(name))
{
qDebug()<< QString("start loading plugin :")+name;
bool ok = _manager->loadPlugin(name);
if (!ok)
{
failins.append(name);
}
ins.append(name);
}
}
if (!failins.isEmpty())
{
QString info = failins.join(",") + QString(tr(" load failed!"));
QMessageBox::warning(this, tr("Warning"), info);
}
if (!failres.isEmpty())
{
QString info = failres.join(",") + QString(tr(" uninstall failed!"));
QMessageBox::warning(this, tr("Warning"), info);
}
Setting::BusAPI::instance()->setPlugins(ins);
emit this->updateMainWindowInteface();
QDialog::accept();
}
}

View File

@ -0,0 +1,51 @@
#ifndef _PLUGINMANAGERDIALOG_H_
#define _PLUGINMANAGERDIALOG_H_
#include <QDialog>
namespace Ui
{
class PluginManageDialog;
}
namespace GUI
{
class MainWindow;
}
namespace Plugins
{
class PluginManager;
class PluginManageDialog : public QDialog
{
Q_OBJECT
public:
PluginManageDialog(GUI::MainWindow* mainwidnow, PluginManager* m);
~PluginManageDialog();
signals:
void updateMainWindowInteface();
private slots:
void on_addButton_clicked();
void on_removeButton_clicked();
void accept() override;
private:
void init();
void appendItemToAvailableList(QString);
void appendItemToSelectedList(QString);
QStringList getSelectedItemNames();
private:
Ui::PluginManageDialog* _ui{};
GUI::MainWindow* _mainWindow{};
PluginManager* _manager{};
};
}
#endif

View File

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PluginManageDialog</class>
<widget class="QDialog" name="PluginManageDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>376</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>组件管理</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>未安装组件:</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="availableList"/>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="addButton">
<property name="text">
<string>&gt;&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeButton">
<property name="text">
<string>&lt;&lt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>已安装组件:</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="selectedList"/>
</item>
</layout>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="customLayout">
<property name="spacing">
<number>0</number>
</property>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>PluginManageDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>PluginManageDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,207 @@
#include "PluginManager.h"
#include "pluginBase.h"
#include "PluginManageDialog.h"
#include "Settings/BusAPI.h"
#include "MainWindow/MainWindow.h"
#include <QApplication>
#include <QFileInfoList>
#include <QDir>
#include <QDomDocument>
#include <QDomNodeList>
#include <QDomElement>
#include <QDebug>
#ifdef Q_OS_WIN
#include <windows.h>
#include <WinBase.h>
#endif
#ifdef Q_OS_UNIX
#include <dlfcn.h>
#endif
namespace Plugins {
PluginManager* PluginManager::_instance = nullptr;
PluginManager* PluginManager::getInstance()
{
if(_instance == nullptr)
_instance = new PluginManager;
return _instance;
}
int PluginManager::getPluginsCount()
{
return _pluginList.size();
}
void PluginManager::releasePlugs()
{
int nplug = _pluginList.size();
for(int i = 0; i < nplug; ++i) {
Plugins::PluginBase* p = _pluginList.at(i);
bool ok = p->uninstall();
if(!ok)
continue;
delete p;
}
_pluginList.clear();
}
void PluginManager::loadPlugs(GUI::MainWindow* m)
{
_mainWindow = m;
if(m != nullptr)
connect(this, SIGNAL(updateActionStates()), m, SIGNAL(updateActionStatesSig()));
QStringList plugins = Setting::BusAPI::instance()->getPlugins();
const QString plugdir = QApplication::applicationDirPath() + "/plugins/";
QDir dir(plugdir);
if(!dir.exists()) {
plugins.clear();
Setting::BusAPI::instance()->setPlugins(plugins);
return;
}
for(int i = 0; i < plugins.size(); ++i) {
QString pluginname = plugins.at(i);
bool ok = loadPlugin(pluginname);
if(!ok)
plugins.removeOne(pluginname);
}
Setting::BusAPI::instance()->setPlugins(plugins);
}
bool PluginManager::loadPlugin(QString pluginname)
{
if(isFileLoaded(pluginname))
return false;
QString lang = Setting::BusAPI::instance()->getLanguage();
const QString plugdir = QApplication::applicationDirPath() + "/plugins/";
QString plugpath = plugdir + pluginname;
qDebug() << pluginname;
typedef void (*Reg)(GUI::MainWindow*, QList<Plugins::PluginBase*>*);
Reg fun = nullptr;
if(!pluginname.toLower().startsWith("plugin"))
return false;
if(!pluginname.toLower().endsWith(".dll"))
return false;
qDebug() << "loading Plugin dll : " << plugpath;
HMODULE hmodel = LoadLibrary(LPCWSTR(plugpath.utf16()));
qDebug()<<"Error Code :"+QString::number(GetLastError());
if(hmodel) {
fun = (Reg)GetProcAddress(hmodel, "Register");
if(fun) {
fun(_mainWindow, &_pluginList);
Plugins::PluginBase* pls = _pluginList.last();
qDebug() << "loading Plugin: " << pls->getDescribe();
pls->install();
pls->setFileName(pluginname);
pls->setWinModule(hmodel);
pls->reTranslate(lang);
qDebug() << "loading Plugin finished : " << pls->getDescribe();
} else {
FreeLibrary(hmodel);
qDebug() << "do not find Register function Plugin: " << plugpath;
return false;
}
}
else{
qDebug() << "loading Plugin dll Failure: " << plugpath;
}
emit updateActionStates();
return true;
}
void PluginManager::reTranslate(QString lang)
{
const int n = _pluginList.size();
for(int i = 0; i < n; ++i) {
auto p = _pluginList.at(i);
p->reTranslate(lang);
}
}
PluginBase* PluginManager::getPluginByDescribe(QString des)
{
for(auto p : _pluginList) {
if(des.toLower() == p->getDescribe().toLower())
return p;
}
return nullptr;
}
void PluginManager::manage()
{
PluginManageDialog dlg(_mainWindow, this);
dlg.exec();
}
bool PluginManager::releasePlugin(QString name)
{
for(auto p : _pluginList) {
if(name == p->getFileName()) {
bool ok = p->uninstall();
if(!ok)
return false;
delete p;
_pluginList.removeOne(p);
break;
}
}
emit updateActionStates();
return true;
}
QList<PluginBase*> PluginManager::getPluginsByType(PluginType t)
{
QList<PluginBase*> ps;
for(PluginBase* p : _pluginList) {
if(p->getType() == t)
ps.append(p);
}
return ps;
}
QDomElement& PluginManager::writeToProjectFile(QDomDocument* doc, QDomElement* parent)
{
QDomElement pgsele = doc->createElement("Plugins");
for(auto p : _pluginList)
p->writeToProjectFile(doc, &pgsele);
parent->appendChild(pgsele);
return pgsele;
}
void PluginManager::readDataFromProjectFile(QDomElement* e)
{
for(auto p : _pluginList)
p->readFromProjectFile(e);
}
bool PluginManager::hasInfoToSave()
{
for(auto p : _pluginList)
if(p->hasInfoToSave())
return true;
return false;
}
bool PluginManager::isFileLoaded(const QString fileName)
{
for(auto p : _pluginList) {
QString name = p->getFileName();
if(name.toLower() == fileName.toLower())
return true;
}
return false;
}
} // namespace Plugins

View File

@ -0,0 +1,77 @@
#ifndef PLUGINMANAGER_H_
#define PLUGINMANAGER_H_
#include "PluginManagerAPI.h"
#include "DataProperty/DataBase.h"
#include "pluginBase.h"
#include <QList>
namespace GUI
{
class MainWindow;
}
namespace Plugins
{
class PluginBase;
class PLUGINMANAGERAPI PluginManager : public DataProperty::DataBase
{
Q_OBJECT
public:
static PluginManager* getInstance();
//获取加载的插件个数
int getPluginsCount();
//加载插件
void loadPlugs(GUI::MainWindow* m);
//加载单个插件
bool loadPlugin(QString name);
//卸载插件
bool releasePlugin(QString name);
//卸载插件
void releasePlugs();
//翻译
void reTranslate(QString lang);
//获取插件
PluginBase* getPluginByDescribe(QString des);
//根据类型获取插件
QList<PluginBase*> getPluginsByType(PluginType t);
//写出工程文件
QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* parent) override;
//从工程文件读入
void readDataFromProjectFile(QDomElement* e) override;
//是否有数据需要保存到工程文件
bool hasInfoToSave();
/**
* @brief
*
* @param fileName XXXX.dll XXXX.so
* @return true
* @return false
*/
bool isFileLoaded(const QString fileName);
signals:
void updateActionStates();
public slots:
void manage();
private:
PluginManager() = default;
~PluginManager() = default;
private:
static PluginManager* _instance;
GUI::MainWindow* _mainWindow{};
QList<PluginBase*> _pluginList{};
};
}
#endif

View File

@ -0,0 +1,13 @@
#ifndef _PLUGINMANAGERAPI_H__
#define _PLUGINMANAGERAPI_H__
#include <QtCore/QtGlobal>
#if defined(PLUGINMANAGER_API)
#define PLUGINMANAGERAPI Q_DECL_EXPORT
#else
#define PLUGINMANAGERAPI Q_DECL_IMPORT
#endif
#endif

View File

@ -0,0 +1,121 @@
#include "pluginBase.h"
#include <QTranslator>
#include <QSettings>
#include <QCoreApplication>
#include <windows.h>
#include <WinBase.h>
namespace Plugins
{
PluginBase::PluginBase()
{
_translator = new QTranslator;
}
PluginBase::~PluginBase()
{
if (_translator != nullptr) delete _translator;
}
void PluginBase::setFileName(QString f)
{
_libFileName = f;
}
QString PluginBase::getFileName()
{
return _libFileName;
}
Plugins::PluginType PluginBase::getPluginType()
{
return _pluginType;
}
void PluginBase::readINI(QSettings* settings)
{
Q_UNUSED(settings)
}
void PluginBase::writeINI(QSettings*)
{
}
void PluginBase::setWinModule(HMODULE m)
{
_winModule = m;
}
HMODULE PluginBase::getWinModule()
{
return _winModule;
}
QString PluginBase::getDescribe()
{
return _describe;
}
bool PluginBase::uninstall()
{
QString path = qApp->applicationDirPath();
QSettings settingwrite(path + "/RasterSetting.ini", QSettings::IniFormat);
this->writeINI(&settingwrite);
return false;
}
bool PluginBase::install()
{
QString path = qApp->applicationDirPath();
QSettings settingreader(path + "/RasterSetting.ini", QSettings::IniFormat);
this->readINI(&settingreader);
return false;
}
void PluginBase::reTranslate(QString lang)
{
qDebug() << lang;
}
void PluginBase::exec(int commandType)
{
Q_UNUSED(commandType)
}
void PluginBase::setType(PluginType t)
{
_pluginType = t;
}
Plugins::PluginType PluginBase::getType()
{
return _pluginType;
}
void PluginBase::writeToProjectFile(QDomDocument* doc, QDomElement* parent)
{
Q_UNUSED(doc)
Q_UNUSED(parent)
}
void PluginBase::readFromProjectFile(QDomElement* parentEle)
{
Q_UNUSED(parentEle)
}
bool PluginBase::hasInfoToSave()
{
return false;
}
}

View File

@ -0,0 +1,96 @@
#ifndef PLUGINBASE_H
#define PLUGINBASE_H
#include <QObject>
#include "PluginManagerAPI.h"
#include "DataProperty/DataBase.h"
#include <QString>
#ifdef Q_OS_WIN
#include <windows.h>
#endif
namespace GUI
{
class MainWindow;
}
class QTranslator;
class QSettings;
class QDomDocument;
class QDomElement;
namespace Plugins
{
enum PluginType
{
None,
IOExtend,
UserTool,
ModelExtend,
Mesher,
};
class PLUGINMANAGERAPI PluginBase : public QObject
{
Q_OBJECT
public:
PluginBase();
~PluginBase();
//加载插件
virtual bool install() = 0;
//卸载插件
virtual bool uninstall() = 0;
//翻译
virtual void reTranslate(QString lang);
//执行插件
virtual void exec(int commandType = 0);
//设置类型
void setType(PluginType t);
//获取类型
PluginType getType();
//写出工程文件
virtual void writeToProjectFile(QDomDocument* doc, QDomElement* parent);
//从工厂文件读入
virtual void readFromProjectFile(QDomElement* parentEle);
//是否有信息需要保存到工程文件
virtual bool hasInfoToSave();
void setFileName(QString f);
QString getFileName();
QString getDescribe();
PluginType getPluginType();
#ifdef Q_OS_WIN
void setWinModule(HMODULE m);
HMODULE getWinModule();
#endif
#ifdef Q_OS_LINUX
void setLinuxModule(void* m);
void* getLinuxModule();
#endif
protected:
virtual void readINI(QSettings* settings);
virtual void writeINI(QSettings* settings);
protected:
QString _libFileName{};
#ifdef Q_OS_WIN
HMODULE _winModule{};
#endif
#ifdef Q_OS_LINUX
void* _linuxModule{};
#endif
QString _describe{};
QTranslator* _translator{};
PluginType _pluginType{ None };
};
}
#endif

View File

@ -0,0 +1,224 @@
#include "ToolBoxWidget.h"
#include <QObject>
#include <QPushButton>
#include "QToolAbstract.h"
#include <QMenu>
#include "ui_ToolBoxWidget.h"
#include <QStringList>
#include <QDir>
#include <QFileInfo>
#ifdef Q_OS_WIN
#include <windows.h>
#include <WinBase.h>
#endif
#ifdef Q_OS_UNIX
#include <dlfcn.h>
#endif
ToolBoxWidget::ToolBoxWidget(LAMPMainWidget::RasterMainWidget* mainWindows, QWidget *parent)
: QWidget(parent), ui(new Ui::ToolBoxWidget), _mainWindows(mainWindows)
{
ui->setupUi(this);
setContextMenuPolicy(Qt::CustomContextMenu); // 设置右键快捷菜单
QObject::connect(this, SIGNAL(addBoxToolItemSIGNAL(QToolAbstract*)), this, SLOT(addBoxToolItemSLOT(QToolAbstract*)));
}
ToolBoxWidget::~ToolBoxWidget()
{}
void ToolBoxWidget::initMenu()
{
contextmenu = new QMenu(this);
//QAction* action1 = contextmenu->addAction(tr(u8"添加工具箱"));
}
void ToolBoxWidget::initToolbox(QString dlltoolPath)
{
// 读取dll 文件,
QDir dir(dlltoolPath); // 获取当前工作目录
// 设置文件过滤规则,只查找包含 "plugin_" 的 dll 文件
QStringList filters;
filters << "PluginTool_*.dll";
// 获取当前目录下所有符合过滤规则的文件
QFileInfoList files = dir.entryInfoList(filters, QDir::Files);
for (const QFileInfo& fileInfo : files) {
QString plugpath = fileInfo.absoluteFilePath();
qDebug() << "Found DLL:" << plugpath;
//continue;
QString pluginname = fileInfo.fileName();
typedef void (*Reg)(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox);
Reg fun = nullptr;
if (!pluginname.toLower().startsWith("plugintool_"))
return ;
if (!pluginname.toLower().endsWith(".dll"))
return ;
HMODULE hmodel = LoadLibrary(LPCWSTR(plugpath.utf16()));
qDebug() << "Error Code :" + QString::number(GetLastError());
if (hmodel) {
fun = (Reg)GetProcAddress(hmodel, "RegisterPreToolBox");
if (fun) {
qDebug() << "loading Plugin started!!!";
fun(this->_mainWindows, this);
qDebug() << "loading Plugin finished : " << plugpath;
}
else {
FreeLibrary(hmodel);
qDebug() << "do not find Register function Plugin: " << plugpath;
return ;
}
}
else {
qDebug() << "loading Plugin dll Failure: " << plugpath;
}
}
}
void ToolBoxWidget::addBoxToolItemSLOT(QToolAbstract* item)
{
QVector<QString> xnodepath = item->getToolXpath();
QString toolName = item->getToolName();
QTreeWidgetItem* parentItem = findOrCreateParentItem(xnodepath);
// 检查该父项是否已经绑定了 toolButton
if (parentItem && ui->treeWidgetToolBox->itemWidget(parentItem, 0) == nullptr) {
toollist.append(QToolboxTreeWidgetItem(ui->treeWidgetToolBox,parentItem,item));
//QTreeWidgetItem* actionItem = new QTreeWidgetItem(parentItem);
//parentItem->addChild(actionItem);
//actionItem->setText(0,toolName);
//QIcon icon(QString::fromUtf8(":/ToolBoxWidget/toolicon"));
//QPushButton* button = new QPushButton(ui->treeWidgetToolBox);
//button->setIcon(icon);
//button->setText(toolName);
//button->setLayoutDirection(Qt::LeftToRight);
//button->setStyleSheet("QPushButton { text-align: left; }");
//ui->treeWidgetToolBox->setItemWidget(actionItem, 0, button);
//connect(button, SIGNAL(clicked()), item, SLOT(excute()));
//item->setParent(ui->treeWidgetToolBox);
//qDebug() << "ToolButton bound to parent:" << actionItem->text(0);
}
else {
qDebug() << "ToolButton already bound to parent:" << parentItem->text(0);
}
}
// 根据路径查找或创建父项
QTreeWidgetItem* ToolBoxWidget::findOrCreateParentItem( QVector<QString>& path) {
QTreeWidgetItem* currentItem = nullptr;
// 从树的顶层开始查找
for ( QString& nodeName : path) {
if (currentItem == nullptr) {
// 如果是顶级节点
currentItem = findOrCreateTopLevelItem(nodeName);
}
else {
// 如果是子节点,查找当前父项下是否存在该子节点
currentItem = findChildItemByName(currentItem, nodeName);
if (currentItem == nullptr) {
currentItem = new QTreeWidgetItem(currentItem);
currentItem->setText(0, nodeName);
}
}
}
return currentItem;
}
// 查找顶级节点,如果没有找到则创建
QTreeWidgetItem* ToolBoxWidget::findOrCreateTopLevelItem( QString& name) {
for (int i = 0; i < ui->treeWidgetToolBox->topLevelItemCount(); ++i) {
QTreeWidgetItem* item = ui->treeWidgetToolBox->topLevelItem(i);
if (item->text(0) == name) {
return item;
}
}
// 如果没有找到,创建新的顶级节点
QTreeWidgetItem* newItem = new QTreeWidgetItem(ui->treeWidgetToolBox);
QIcon icon(QString::fromUtf8(":/RasterProcessTool/toolboxIcon"));
newItem->setIcon(0,icon);
newItem->setTextAlignment(0, Qt::AlignLeft);
newItem->setText(0, name);
return newItem;
}
// 查找子节点,如果没有找到则返回 nullptr
QTreeWidgetItem* ToolBoxWidget::findChildItemByName(QTreeWidgetItem* parentItem, QString& name) {
for (int i = 0; i < parentItem->childCount(); ++i) {
QTreeWidgetItem* childItem = parentItem->child(i);
if (childItem->text(0) == name) {
return childItem;
}
}
return nullptr;
}
void ToolBoxWidget::OpenToolboxManagerWidget()
{
}
QToolboxTreeWidgetItem::QToolboxTreeWidgetItem(QTreeWidget* IntreeWidgetToolBox, QTreeWidgetItem* InparentItem, QToolAbstract* Initem)
{
this->parentItem = InparentItem;
this->item = Initem;
this->actionItem = new QTreeWidgetItem(parentItem);
this->button = new QPushButton(IntreeWidgetToolBox);
QString toolName = item->getToolName();
parentItem->addChild(actionItem);
actionItem->setText(0, toolName);
QIcon icon(QString::fromUtf8(":/RasterProcessTool/toolicon.png"));
button->setIcon(icon);
button->setText(toolName);
button->setLayoutDirection(Qt::LeftToRight);
button->setStyleSheet("QPushButton { text-align: left;font-size: 12px; font-weight: normal; }");
IntreeWidgetToolBox->setItemWidget(actionItem, 0, button);
QObject::connect(button, SIGNAL(clicked()), item, SLOT(excute()));
item->setParent(IntreeWidgetToolBox);
qDebug() << "ToolButton bound to parent:" << actionItem->text(0);
}
QToolboxTreeWidgetItem::~QToolboxTreeWidgetItem()
{
}
QTreeWidgetItem* QToolboxTreeWidgetItem::getTreeWidgetItem()
{
return this->actionItem;
}
QPushButton* QToolboxTreeWidgetItem::getPushButton()
{
return this->button;
}
QToolAbstract* QToolboxTreeWidgetItem::getToolAbstract()
{
return this->item;
}
QTreeWidgetItem* QToolboxTreeWidgetItem::getParantTreeWidgetItem()
{
return this->parentItem;
}

View File

@ -0,0 +1,69 @@
#pragma once
#include "RasterProcessToolWidgetAPI.h"
#include <QtWidgets/QMainWindow>
#include "QToolAbstract.h"
#include <QMenu>
namespace Ui {
class ToolBoxWidget;
}
namespace LAMPMainWidget {
class RasterMainWidget;
}
class QToolboxTreeWidgetItem {
public:
QToolboxTreeWidgetItem(QTreeWidget* treeWidgetToolBox,QTreeWidgetItem* parentItem,QToolAbstract* item);
~QToolboxTreeWidgetItem();
private:
QTreeWidgetItem* actionItem=nullptr;
QPushButton* button = nullptr;
QToolAbstract* item = nullptr;
QTreeWidgetItem* parentItem = nullptr;
public:
QTreeWidgetItem* getTreeWidgetItem();
QPushButton* getPushButton();
QToolAbstract* getToolAbstract();
QTreeWidgetItem* getParantTreeWidgetItem();
};
class RASTERPROCESSTOOLWIDGET_EXPORT ToolBoxWidget : public QWidget
{
Q_OBJECT
public:
ToolBoxWidget(LAMPMainWidget::RasterMainWidget* mainWindows=nullptr,QWidget *parent = nullptr);
~ToolBoxWidget();
public:
void initMenu();
void initToolbox(QString dlltoolPath);
private:
QMenu* contextmenu;
QList<QToolboxTreeWidgetItem> toollist;
signals:
void addBoxToolItemSIGNAL(QToolAbstract* item);
public slots:
void addBoxToolItemSLOT(QToolAbstract* item);
QTreeWidgetItem* findOrCreateParentItem( QVector<QString>& path);
QTreeWidgetItem* findOrCreateTopLevelItem( QString& name);
QTreeWidgetItem* findChildItemByName(QTreeWidgetItem* parentItem, QString& name);
public slots:
// 打开工具箱管理界面
void OpenToolboxManagerWidget();
private:
Ui::ToolBoxWidget* ui;
LAMPMainWidget::RasterMainWidget* _mainWindows;//主窗口
};

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ToolBoxWidget</class>
<widget class="QWidget" name="ToolBoxWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>289</width>
<height>433</height>
</rect>
</property>
<property name="windowTitle">
<string>工具箱</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTreeWidget" name="treeWidgetToolBox">
<property name="font">
<font>
<family>黑体</family>
<pointsize>12</pointsize>
</font>
</property>
<column>
<property name="text">
<string>工具箱</string>
</property>
<property name="icon">
<iconset resource="RasterProcessTool.qrc">
<normaloff>:/RasterProcessTool/toolboxIcon</normaloff>:/RasterProcessTool/toolboxIcon</iconset>
</property>
</column>
</widget>
</item>
</layout>
<action name="actionmergeRaster">
<property name="text">
<string>mergeRaster</string>
</property>
</action>
<action name="actionImportGF3Strip">
<property name="text">
<string>ImportGF3Strip</string>
</property>
</action>
<action name="actioncomplex2amporphase">
<property name="text">
<string>complex2amporphase</string>
</property>
</action>
<action name="actionlooktableCreate">
<property name="text">
<string>looktableCreate</string>
</property>
</action>
<action name="actionorthinterpRaster">
<property name="text">
<string>orthinterpRaster</string>
</property>
</action>
<action name="actionSARRFPC">
<property name="text">
<string>SARRFPC</string>
</property>
</action>
<action name="actionSimuSARRFPC">
<property name="text">
<string>SimuSARRFPC</string>
</property>
</action>
<action name="actionSimuBPImage">
<property name="text">
<string>SimuBPImage</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="RasterProcessTool.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,5 @@
// 提示文件帮助 Visual Studio IDE 解释 Visual C++ 标识符,
// 如函数和宏的名称。
// 有关详细信息,请参见 https://go.microsoft.com/fwlink/?linkid=865984
#define Q_OBJECT public: QT_WARNING_PUSH Q_OBJECT_NO_OVERRIDE_WARNING static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); QT_TR_FUNCTIONS private: Q_OBJECT_NO_ATTRIBUTES_WARNING Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); QT_WARNING_POP struct QPrivateSignal {}; QT_ANNOTATE_CLASS(qt_qobject, "")
#define Q_OBJECT

View File

@ -0,0 +1,23 @@
#include "RasterProcessTool.h"
#include <QtWidgets/QApplication>
#include <QCoreApplication>
#include <QDebug>
#include <QFile>
#include <QTextStream>
#include <QDateTime>
//
//
//int main(int argc, char *argv[])
//{
// QApplication a(argc, argv);
// //qInstallMessageHandler(customMessageHandler);
//
// RasterProcessTool* w=new RasterProcessTool;// Ö÷½çÃæ
// w->show();
// return a.exec();
//}

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1,10 +0,0 @@
#include "QSimulationRTPCGUI.h"
QSimulationRTPCGUI::QSimulationRTPCGUI(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
}
QSimulationRTPCGUI::~QSimulationRTPCGUI()
{}

View File

@ -1,16 +0,0 @@
#pragma once
#include <QDialog>
#include "ui_QSimulationRTPCGUI.h"
class QSimulationRTPCGUI : public QDialog
{
Q_OBJECT
public:
QSimulationRTPCGUI(QWidget *parent = nullptr);
~QSimulationRTPCGUI();
private:
Ui::QSimulationRTPCGUIClass ui;
};

Binary file not shown.

View File

@ -0,0 +1,56 @@
#pragma once
#include <QtCore/QtGlobal>
#include <QtCore/QDebug>
#include <QtCore/QTime>
#include <QRandomGenerator>
namespace LAMPMainWidget {
/*
*
*/
const double DoublePrecision{0.00000001};
/*
* d1d2
* @param d1
* @param d2
* @param precision
* @return truefalse
*/
inline bool
isDoubleNearby(double d1, double d2, double precision = DoublePrecision) {
return qAbs(d1 - d2) < precision;
}
/*
* minmax
* @param min
* @param max
* @return
*/
inline int
randomInt(int min, int max) {
if (max <= min) {
qDebug() << "随机数的最大值大于最小值";
return -1;
}
//qsrand(static_cast<uint>(QTime{0, 0}.msecsTo(QTime::currentTime())));
quint32 seed = static_cast<quint32>(QTime{ 0, 0 }.msecsTo(QTime::currentTime()));
QRandomGenerator seededGenerator(seed);
return min + seededGenerator.bounded(max - min) ;
}
/*
* 2
* @param n
* @return
*/
inline int
power2(int n) {
return 1u << static_cast<unsigned>(n);
}
}

View File

@ -0,0 +1,22 @@
#pragma once
#ifndef LAMPMAINWIDGET_H_
#define LAMPMAINWIDGET_H_
//#include <QtCore/qglobal.h>
//# if defined(LAMPMAINWIDGET_LIB)
//# define LAMPMAINWIDGET_EXPORT Q_DECL_EXPORT
//# else
//# define LAMPMAINWIDGET_EXPORT Q_DECL_IMPORT
//# endif
#ifdef RASTERMAINWIDGETGUI_LIB
#define RASTERMAINWIDGETGUI_EXPORT __declspec(dllexport)
#else
#define RASTERMAINWIDGETGUI_EXPORT __declspec(dllimport)
#endif
#endif // !LAMPMAINWIDGET_H_

View File

@ -0,0 +1,10 @@
#include "LAMPMainWidgetRunProgram.h"
#include "RasterMainWidget.h"
void RasterMainWidgetRun()
{
LAMPMainWidget::RasterMainWidget* w = new LAMPMainWidget::RasterMainWidget;
//RasterProcessTool w;
w->show();
}

View File

@ -0,0 +1,10 @@
#pragma once
#ifndef LAMPMAINWIDGETRUNPROGRAM_H_
#define LAMPMAINWIDGETRUNPROGRAM_H_
#include "LAMPMainWidgetAPI.h"
extern "C" void RASTERMAINWIDGETGUI_EXPORT RasterMainWidgetRun();
#endif

View File

@ -0,0 +1,337 @@
#include <QLabel>
#include <QDesktopServices>
#include <QMessageBox>
#include <QTableWidgetItem>
#include "RasterMainWidget.h"
#include "ui_RasterMainWidget.h"
#include <sponsorwindow.h>
#include <taskwindow.h>
#include <tmslayer.h>
#include <QDockWidget>
#include "ToolBoxWidget.h"
#include "BaseTool.h"
#include "FileOperator.h"
#pragma execution_character_set("utf-8")
namespace LAMPMainWidget {
QString
RasterMainWidget::tutorialUrl() {
return QString{R"(https://gitee.com/qizr_admin/LAMPMainWidget)"};
}
QString
RasterMainWidget::srcUrl() {
return QString{R"(https://gitee.com/qizr_admin/LAMPMainWidget)"};
}
QHash<QString, MapLayer *>RasterMainWidget::mMaps{};
RasterMainWidget::RasterMainWidget(QWidget *parent)
: mUi(new Ui::RasterMainWidget),
mMapConvas(new MapCanvas),
mScaleText(new QLineEdit),
mScaleLabel(new QLabel),
mCenterText(new QLineEdit),
mCenterLabel(new QLabel),
mZoomText(new QLineEdit),
mZoomLabel(new QLabel),
mMapActionGroup(new QActionGroup(dynamic_cast<QObject *>(this))),
mSetLeftTop(true),
mLayerList(),
mLeftTop(),
mRightBottom() {
this->setWindowTitle(tr(u8"LAMP影像处理软件"));
mUi->setupUi(dynamic_cast<QMainWindow*>(this));
setupWindow();
setupTaskWindow();
setupLayers();
setupStatusBar();
setupActions();
setRightToolbox();
mUi->panAction->trigger();
mUi->layerList->setCurrentItem(mLayerList.first());
}
RasterMainWidget::~RasterMainWidget() {
delete mUi;
delete mMapConvas;
delete mScaleText;
delete mScaleLabel;
delete mCenterText;
delete mCenterLabel;
}
void
RasterMainWidget::setupTaskWindow() {
mUi->taskTable->setColumnCount(5);
mUi->taskTable->setHorizontalHeaderLabels(QStringList{
"名称", "范围", "zoom值", "数据源", "进度"
});
mUi->taskTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
}
void
RasterMainWidget::setupActions() {
mMapActionGroup->addAction(mUi->panAction);
mMapActionGroup->addAction(mUi->zoomInAction);
mMapActionGroup->addAction(mUi->zoomOutAction);
mMapActionGroup->addAction(mUi->selectAction);
mUi->selectAction->setEnabled(false);
QObject::connect(mUi->panAction, &QAction::triggered, this, &RasterMainWidget::panHandle);
QObject::connect(mUi->zoomInAction, &QAction::triggered, this, &RasterMainWidget::zoomInHandle);
QObject::connect(mUi->zoomOutAction, &QAction::triggered, this, &RasterMainWidget::zoomOutHandle);
QObject::connect(mUi->tutorialAction, &QAction::triggered, this, &RasterMainWidget::tutorialHanle);
QObject::connect(mUi->srcAction, &QAction::triggered, this, &RasterMainWidget::srcHandle);
QObject::connect(mUi->refreshAction, &QAction::triggered, this, &RasterMainWidget::refreshHandle);
QObject::connect(mUi->sponsorAction, &QAction::triggered, this, &RasterMainWidget::sponsorHandle);
QObject::connect(mUi->selectAction, &QAction::triggered, this, &RasterMainWidget::selectHandle);
QObject::connect(mUi->downloadAction, &QAction::triggered, this, &RasterMainWidget::createDownloadTask);
QObject::connect(mUi->drawlineAction, &QAction::triggered, this, &RasterMainWidget::drawlineHandle);
}
void RasterMainWidget::setupWindow() {
mUi->mapCanvasLayout->addWidget(mMapConvas);
setFixedSize(size());
setWindowFlags(windowFlags() & ~Qt::WindowMaximizeButtonHint);
QObject::connect(mMapConvas, &MapCanvas::zoomChanged, this, &RasterMainWidget::zoomChangedHandle);
QObject::connect(mMapConvas, &MapCanvas::clicked, this, &RasterMainWidget::clickedHandle);
QObject::connect(mMapConvas, &MapCanvas::mapCenterChanged, this, &RasterMainWidget::centerChangedHandle);
QObject::connect(mUi->layerList, &QListWidget::currentItemChanged, this, &RasterMainWidget::layerChanged);
QObject::connect(mUi->leftTopBtn, &QPushButton::clicked, this, &RasterMainWidget::leftTopClickedHandle);
QObject::connect(mUi->rightBottomBtn, &QPushButton::clicked, this, &RasterMainWidget::rightBottomClickedHandle);
}
void RasterMainWidget::setupStatusBar() {
/// 比例尺
mScaleLabel->setText("比例尺");
mScaleText->setText(QString("1cm : %1m").arg(mMapConvas->scale()));
mScaleText->setFixedWidth(150);
mScaleText->setReadOnly(true);
mUi->statusbar->addWidget(mScaleLabel);
mUi->statusbar->addWidget(mScaleText);
/// 空白间隔
mUi->statusbar->addWidget(spacerWiget(30));
/// zoom值
mZoomLabel->setText("Zoom值=>");
mZoomText->setText(QString("%1").arg(mMapConvas->zoomValue()));
mZoomText->setFixedWidth(80);
mZoomText->setReadOnly(true);
mUi->statusbar->addWidget(mZoomLabel);
mUi->statusbar->addWidget(mZoomText);
/// 空白间隔
mUi->statusbar->addWidget(spacerWiget(30));
/// 视图中心坐标
mCenterLabel->setText("视图中心坐标=>");
PointXY center = mMapConvas->mapCenter();
mCenterText->setText(QString("lon:%1, lat:%2").arg(center.x()).arg(center.y()));
mCenterText->setFixedWidth(300);
mCenterText->setReadOnly(true);
mUi->statusbar->addWidget(mCenterLabel);
mUi->statusbar->addWidget(mCenterText);
}
void RasterMainWidget::setupLayers() {
initMaps();
auto i = mMaps.constBegin();
for (; i != mMaps.constEnd(); ++i) {
mLayerList.append(new QListWidgetItem(i.key(), mUi->layerList));
}
}
void
RasterMainWidget::initMaps() {
if (mMaps.isEmpty()) {
mMaps = QHash<QString, MapLayer *>{
{"Openstreet地图", new TmsLayer(OSTNormalMap, "ostnormalmap", mMapConvas)},
{"高德地图", new TmsLayer(GaodeNormapMap, "gaodenormalmap", mMapConvas)}
};
}
}
void RasterMainWidget::setRightToolbox()
{
this->toolboxDockWidget = new QDockWidget(tr(u8"工具箱"), this);
toolboxDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
toolBoxWidget = new ToolBoxWidget(this);
toolboxDockWidget->setWidget(toolBoxWidget);
addDockWidget(Qt::LeftDockWidgetArea, toolboxDockWidget);
setDockOptions(QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks);
this->initToolbox();
}
void RasterMainWidget::initToolbox()
{
QString appPath = QCoreApplication::applicationDirPath();
QString pluginPath = JoinPath(appPath, "Toolbox");
toolBoxWidget->initToolbox(pluginPath);
}
QWidget *RasterMainWidget::spacerWiget(int width) const {
auto spacer = new QWidget{};
spacer->setHidden(true);
spacer->setVisible(true);
spacer->setFixedWidth(width);
return spacer;
}
void
RasterMainWidget::panHandle(bool checked) {
mMapConvas->selectTool(QString{"pan_tool"});
}
void
RasterMainWidget::zoomInHandle(bool checked) {
mMapConvas->selectTool(QString{"zoomin_tool"});
}
void
RasterMainWidget::zoomOutHandle(bool checked) {
mMapConvas->selectTool(QString{"zoomout_tool"});
}
void RasterMainWidget::drawlineHandle(bool checked)
{
mMapConvas->selectTool("drawline_tool");
}
void
RasterMainWidget::tutorialHanle(bool checked) {
if (!QDesktopServices::openUrl(tutorialUrl())) {
QMessageBox::critical(dynamic_cast<QWidget *>(this), "异常", "未能打开系统浏览器");
}
}
void
RasterMainWidget::srcHandle(bool checked) {
if (!QDesktopServices::openUrl(srcUrl())) {
QMessageBox::critical(dynamic_cast<QWidget *>(this), "异常", "未能打开系统浏览器");
}
}
void
RasterMainWidget::sponsorHandle(bool checked) {
auto *window = new SponsorWindow(dynamic_cast<QWidget *>(this));
window->exec();
window->deleteLater();
}
void
RasterMainWidget::refreshHandle(bool checked) {
mMapConvas->refreshMap();
}
void
RasterMainWidget::selectHandle(bool checked) {
mMapConvas->selectTool(QString{"select_tool"});
}
void
RasterMainWidget::centerChangedHandle(LAMPMainWidget::PointXY pos) {
mCenterText->setText(QString("lon:%1, lat:%2").arg(pos.x()).arg(pos.y()));
}
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) {
QString posText = QString("%1, %2").arg(pos.x()).arg(pos.y());
if (mSetLeftTop) {
mUi->leftTopText->setText(posText);
mLeftTop = pos;
} else {
mUi->rightBottomText->setText(posText);
mRightBottom = pos;
}
}
void
RasterMainWidget::leftTopClickedHandle() {
mSetLeftTop = true;
mUi->selectAction->trigger();
}
void
RasterMainWidget::rightBottomClickedHandle() {
mSetLeftTop = false;
mUi->selectAction->trigger();
}
void
RasterMainWidget::layerChanged(QListWidgetItem *current, QListWidgetItem *previous) {
auto mapName = current->text();
if (!mMaps.contains(mapName)) {
qDebug() << mapName << "不支持";
return;
}
auto layer = mMaps.value(mapName);
auto i = mMaps.begin();
for (; i != mMaps.end(); ++i) {
if (i.key() == mapName) {
i.value()->setVisiblity(true);
qDebug() << i.key() << i.value()->isVisible();
continue;
}
i.value()->setVisiblity(false);
}
mMapConvas->addLayer(layer);
mMapConvas->setCurrentLayer(layer->id());
mMapConvas->refreshMap();
zoomChangedHandle(mMapConvas->zoomValue());
centerChangedHandle(mMapConvas->mapCenter());
}
void
RasterMainWidget::createDownloadTask() {
auto taskWindow = new TaskWindow(dynamic_cast<QWidget *>(this));
taskWindow->exec();
taskWindow->deleteLater();
}
void
RasterMainWidget::changeTaskTable(int row, int col, QString text) {
mUi->taskTable->takeItem(row, col);
mUi->taskTable->setItem(row, col, new QTableWidgetItem(text));
}
void RasterMainWidget::on_drawArea_triggered()
{
mMapConvas->selectTool("drawarea_tool");
}
void RasterMainWidget::on_addPlaneaction_triggered()
{
mMapConvas->selectTool("addplane_tool");
}
QTableWidget* RasterMainWidget::getTaskTable()
{
return this->mUi->taskTable;
}
}

View File

@ -0,0 +1,109 @@
#pragma once
#include "LAMPMainWidgetAPI.h"
#include <QMainWindow>
#include <QVector>
#include <QLabel>
#include <QLineEdit>
#include <QWidget>
#include <QActionGroup>
#include <QListWidgetItem>
#include <QHash>
#include <QTableWidget>
#include <mapcanvas.h>
#include <maplayer.h>
#include "QApplicationSettingManager.h"
#include "ToolBoxWidget.h"
namespace Ui {
class RasterMainWidget;
}
namespace LAMPMainWidget {
class RasterMainWidget : public QMainWindow {
Q_OBJECT
friend class TaskWindow;
friend class DownloadTask;
public slots:
void changeTaskTable(int row, int col, QString text);
public:
RasterMainWidget(QWidget* parent = nullptr);
~RasterMainWidget() override;
protected:
void setupWindow();
void setupActions();
void setupStatusBar();
void setupLayers();
void setupTaskWindow();
void initMaps();
void setRightToolbox();
void initToolbox();
protected:
/// 各处处理函数
void panHandle(bool checked);
void zoomInHandle(bool checked);
void zoomOutHandle(bool checked);
void drawlineHandle(bool checked);
void tutorialHanle(bool checked);
void srcHandle(bool checked);
void sponsorHandle(bool checked);
void refreshHandle(bool checked);
void selectHandle(bool checked);
void zoomChangedHandle(int zoom);
void clickedHandle(PointXY pos);
void centerChangedHandle(PointXY pos);
void leftTopClickedHandle();
void rightBottomClickedHandle();
void createDownloadTask();
void layerChanged(QListWidgetItem* current, QListWidgetItem* previous);
private:
QWidget* spacerWiget(int width) const;
protected:
static QString tutorialUrl();
static QString srcUrl();
private slots:
void on_drawArea_triggered();
void on_addPlaneaction_triggered();
private:
Ui::RasterMainWidget* mUi;
MapCanvas* mMapConvas;
QLineEdit* mScaleText;
QLabel* mScaleLabel;
QLineEdit* mCenterText;
QLabel* mCenterLabel;
QLineEdit* mZoomText;
QLabel* mZoomLabel;
QActionGroup* mMapActionGroup;
bool mSetLeftTop;
QVector<QListWidgetItem*> mLayerList;
PointXY mLeftTop;
PointXY mRightBottom;
QDockWidget* toolboxDockWidget;
ToolBoxWidget* toolBoxWidget;
private:
static QHash<QString, MapLayer*> mMaps;
public:
QTableWidget* getTaskTable();
};
}

View File

@ -0,0 +1,420 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RasterMainWidget</class>
<widget class="QMainWindow" name="RasterMainWidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>810</width>
<height>637</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>地图下载器</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1441</width>
<height>911</height>
</rect>
</property>
<layout class="QGridLayout" name="mainLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="mapTab">
<attribute name="title">
<string>地图</string>
</attribute>
<widget class="QWidget" name="gridLayoutWidget_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1241</width>
<height>881</height>
</rect>
</property>
<layout class="QGridLayout" name="mapCanvasLayout"/>
</widget>
<widget class="QWidget" name="gridLayoutWidget_3">
<property name="geometry">
<rect>
<x>1250</x>
<y>-1</y>
<width>191</width>
<height>881</height>
</rect>
</property>
<layout class="QGridLayout" name="infoLayout">
<item row="0" column="1">
<widget class="QGroupBox" name="layersListGbx">
<property name="title">
<string/>
</property>
<widget class="QGroupBox" name="layersGbx">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>171</width>
<height>611</height>
</rect>
</property>
<property name="title">
<string>图层列表</string>
</property>
<widget class="QWidget" name="gridLayoutWidget_4">
<property name="geometry">
<rect>
<x>9</x>
<y>30</y>
<width>151</width>
<height>571</height>
</rect>
</property>
<layout class="QGridLayout" name="layersLayout">
<item row="0" column="0">
<widget class="QListWidget" name="layerList"/>
</item>
</layout>
</widget>
</widget>
<widget class="QGroupBox" name="downloadGbx">
<property name="geometry">
<rect>
<x>10</x>
<y>650</y>
<width>171</width>
<height>221</height>
</rect>
</property>
<property name="title">
<string>下载区域</string>
</property>
<widget class="QLineEdit" name="leftTopText">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>151</width>
<height>31</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="leftTopBtn">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>151</width>
<height>25</height>
</rect>
</property>
<property name="toolTip">
<string>点击开始选择左上角点</string>
</property>
<property name="text">
<string>选择左上角</string>
</property>
</widget>
<widget class="QLineEdit" name="rightBottomText">
<property name="geometry">
<rect>
<x>12</x>
<y>140</y>
<width>151</width>
<height>31</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="rightBottomBtn">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>151</width>
<height>25</height>
</rect>
</property>
<property name="toolTip">
<string>点击开始选择右下角点</string>
</property>
<property name="text">
<string>选择右下角</string>
</property>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="taskTab">
<attribute name="title">
<string>任务</string>
</attribute>
<widget class="QWidget" name="gridLayoutWidget_5">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1431</width>
<height>871</height>
</rect>
</property>
<layout class="QGridLayout" name="taskLayout">
<item row="0" column="0">
<widget class="QTableWidget" name="taskTable"/>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>810</width>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="projectMenu">
<property name="title">
<string>项目</string>
</property>
</widget>
<widget class="QMenu" name="editMenu">
<property name="title">
<string>编辑</string>
</property>
</widget>
<widget class="QMenu" name="viewMenu">
<property name="title">
<string>视图</string>
</property>
</widget>
<widget class="QMenu" name="layersMenu">
<property name="title">
<string>图层</string>
</property>
</widget>
<widget class="QMenu" name="optionsMenu">
<property name="title">
<string>设置</string>
</property>
</widget>
<widget class="QMenu" name="toolsMenu">
<property name="title">
<string>工具</string>
</property>
</widget>
<widget class="QMenu" name="helpMenu">
<property name="title">
<string>帮助</string>
</property>
<addaction name="tutorialAction"/>
<addaction name="srcAction"/>
<addaction name="separator"/>
</widget>
<addaction name="projectMenu"/>
<addaction name="editMenu"/>
<addaction name="viewMenu"/>
<addaction name="layersMenu"/>
<addaction name="optionsMenu"/>
<addaction name="toolsMenu"/>
<addaction name="helpMenu"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="selectAction"/>
<addaction name="panAction"/>
<addaction name="zoomInAction"/>
<addaction name="zoomOutAction"/>
<addaction name="refreshAction"/>
<addaction name="drawArea"/>
<addaction name="drawlineAction"/>
<addaction name="separator"/>
<addaction name="addPlaneaction"/>
<addaction name="downloadAction"/>
<addaction name="separator"/>
</widget>
<action name="tutorialAction">
<property name="text">
<string>使用教程</string>
</property>
</action>
<action name="srcAction">
<property name="text">
<string>源码</string>
</property>
<property name="toolTip">
<string>源码</string>
</property>
</action>
<action name="sponsorAction">
<property name="text">
<string>捐赠</string>
</property>
</action>
<action name="panAction">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset theme="default" resource="../resource/res.qrc">
<normaloff>:/themes/mActionPan</normaloff>:/themes/mActionPan</iconset>
</property>
<property name="text">
<string>拖动</string>
</property>
<property name="toolTip">
<string>拖动图层,查看不同地方</string>
</property>
</action>
<action name="zoomInAction">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset theme="default" resource="../resource/res.qrc">
<normaloff>:/themes/mActionZoomIn</normaloff>:/themes/mActionZoomIn</iconset>
</property>
<property name="text">
<string>放大</string>
</property>
<property name="toolTip">
<string>增大zoom值</string>
</property>
</action>
<action name="zoomOutAction">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset theme="default" resource="../resource/res.qrc">
<normaloff>:/themes/mActionZoomOut</normaloff>:/themes/mActionZoomOut</iconset>
</property>
<property name="text">
<string>缩小</string>
</property>
<property name="toolTip">
<string>减小zoom值</string>
</property>
</action>
<action name="refreshAction">
<property name="icon">
<iconset theme="default" resource="../resource/res.qrc">
<normaloff>:/themes/mActionRefresh</normaloff>:/themes/mActionRefresh</iconset>
</property>
<property name="text">
<string>刷新地图</string>
</property>
<property name="toolTip">
<string>刷新地图显示内容</string>
</property>
</action>
<action name="downloadAction">
<property name="icon">
<iconset theme="default" resource="../resource/res.qrc">
<normaloff>:/themes/mActionDownload</normaloff>:/themes/mActionDownload</iconset>
</property>
<property name="text">
<string>下载</string>
</property>
<property name="toolTip">
<string>创建下载任务</string>
</property>
</action>
<action name="selectAction">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset theme="default" resource="../resource/res.qrc">
<normaloff>:/themes/mActionSelect</normaloff>:/themes/mActionSelect</iconset>
</property>
<property name="text">
<string>选择</string>
</property>
<property name="toolTip">
<string>选择地图中点</string>
</property>
</action>
<action name="drawlineAction">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>航线</string>
</property>
<property name="toolTip">
<string>绘制航线</string>
</property>
</action>
<action name="drawArea">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>区域</string>
</property>
</action>
<action name="addPlaneaction">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../resource/res.qrc">
<normaloff>:/plane-red.png</normaloff>:/plane-red.png</iconset>
</property>
<property name="text">
<string>飞机</string>
</property>
</action>
</widget>
<resources>
<include location="../RasterMainWidgetGUI.qrc"/>
<include location="../resource/res.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,199 @@
//#include <QDebug>
//#include <proj_api.h>
//
//#include <crs.h>
//#pragma execution_character_set("utf-8")
//
//namespace LAMPMainWidget {
//
//PointXY
//CRS::forward(const PointXY &point) const {
// auto pjCtx = pj_ctx_alloc();
// auto pjLonlat = pj_init_plus_ctx(pjCtx, "+proj=longlat +datum=WGS84 +no_defs");
// if (!pjLonlat) {
// qWarning() << "初始化wgs84坐标系失败=>" << pj_strerrno(pj_ctx_get_errno(pjCtx));
// pj_ctx_free(pjCtx);
// return PointXY{};
// }
// auto pjDest = pj_init_plus_ctx(pjCtx, proj4Def().toStdString().c_str());
// if (!pjDest) {
// qWarning() << "初始化目标坐标系失败=>" << pj_strerrno(pj_ctx_get_errno(pjCtx));
// pj_free(pjLonlat);
// pj_ctx_free(pjCtx);
// return PointXY{};
// }
//
// double x{point.x() * DEG_TO_RAD}, y{point.y() * DEG_TO_RAD};
// auto err = pj_transform(pjLonlat, pjDest, 1, 1, &x, &y, nullptr);
// if (err) {
// qWarning() << "坐标转换失败=>" << point;
// pj_free(pjDest);
// pj_free(pjLonlat);
// pj_ctx_free(pjCtx);
// return PointXY{};
// }
//
// pj_free(pjDest);
// pj_free(pjLonlat);
// pj_ctx_free(pjCtx);
//
// return PointXY{x, y};
//}
//
//PointXY
//CRS::inverse(const PointXY &point) const {
// auto pjCtx = pj_ctx_alloc();
// auto pjLonlat = pj_init_plus_ctx(pjCtx, "+proj=longlat +datum=WGS84 +no_defs");
// if (!pjLonlat) {
// qWarning() << "初始化wgs84坐标系失败=>" << pj_strerrno(pj_ctx_get_errno(pjCtx));
// pj_ctx_free(pjCtx);
// return PointXY{};
// }
// auto pjDest = pj_init_plus_ctx(pjCtx, proj4Def().toStdString().c_str());
// if (!pjDest) {
// qWarning() << "初始化目标坐标系失败=>" << pj_strerrno(pj_ctx_get_errno(pjCtx));
// pj_free(pjLonlat);
// pj_ctx_free(pjCtx);
// return PointXY{};
// }
//
// double x{point.x()}, y{point.y()};
// auto err = pj_transform(pjDest, pjLonlat, 1, 1, &x, &y, nullptr);
// if (err) {
// qWarning() << "坐标转换失败=>" << point;
// pj_free(pjDest);
// pj_free(pjLonlat);
// pj_ctx_free(pjCtx);
// return PointXY{};
// }
//
// pj_free(pjDest);
// pj_free(pjLonlat);
// pj_ctx_free(pjCtx);
//
// return PointXY{x * RAD_TO_DEG, y * RAD_TO_DEG};
//}
//
//}
#include <QDebug>
#include <proj.h>
#include <crs.h>
#pragma execution_character_set("utf-8")
namespace LAMPMainWidget {
PointXY
CRS::forward(const PointXY& point) const {
const double DEG_TO_RAD = 0.017453292519943295;
PJ_CONTEXT* pjCtx = proj_context_create();
if (!pjCtx) {
qWarning() << u8"Create proj context failed";
return PointXY{};
}
// PJ* target_crs = proj_create(pjCtx, proj4Def().toStdString().c_str());
// if (!target_crs) {
// qWarning() << "Failed to create target CRS from PROJ string";
// return PointXY{};
// }
//
//
//const char* wkt = proj_as_wkt(pjCtx, target_crs, PJ_WKT2_2019, nullptr);
// if (wkt) {
// printf("CRS (WKT):\n%s\n", wkt);
// //return PointXY{};
// }
qWarning() << "create target_crs sucessfully";
PJ* pjLonlat = proj_create_crs_to_crs(pjCtx,
"EPSG:4326", // WGS84
proj4Def().toStdString().c_str(),
nullptr);
if (!pjLonlat) {
qWarning() << u8"convert unsucessfully from EPSG:4326 to target project coodination =>" << proj_errno_string(proj_context_errno(pjCtx));
//proj_destroy(target_crs);
proj_context_destroy(pjCtx);
return PointXY{};
}
PJ_COORD coordIn, coordOut;
coordIn.lpzt.lam = point.x() * DEG_TO_RAD;
coordIn.lpzt.phi = point.y() * DEG_TO_RAD;
coordOut = proj_trans(pjLonlat, PJ_FWD, coordIn);
if (proj_errno(pjLonlat)) {
qWarning() << u8"convert unsucessfully point from EPSG:4326 to point in EPSG:4326=>" << point;
proj_destroy(pjLonlat);
//proj_destroy(target_crs);
proj_context_destroy(pjCtx);
return PointXY{};
}
proj_destroy(pjLonlat);
//proj_destroy(target_crs);
proj_context_destroy(pjCtx);
return PointXY{ coordOut.xy.x, coordOut.xy.y };
}
PointXY
CRS::inverse(const PointXY& point) const {
const double RAD_TO_DEG = 57.29577951308232;
PJ_CONTEXT* pjCtx = proj_context_create();
if (!pjCtx) {
qWarning() << u8"create proj context ";
return PointXY{};
}
//PJ* target_crs = proj_create(pjCtx, proj4Def().toStdString().c_str());
//if (!target_crs) {
// qWarning() << "Failed to create target CRS from PROJ string";
// return PointXY{};
//}
//qWarning() << "create target_crs sucessfully";
//const char* wkt = proj_as_wkt(pjCtx, target_crs, PJ_WKT2_2019, nullptr);
//if (wkt) {
// printf("CRS (WKT):\n%s\n", wkt);
// return PointXY{};
//}
qWarning() << "create target_crs sucessfully";
PJ* pjLonlat = proj_create_crs_to_crs(pjCtx,
"EPSG:4326", // WGS84
proj4Def().toStdString().c_str(),
nullptr);
if (!pjLonlat) {
qWarning() << u8"=>" << proj_errno_string(proj_context_errno(pjCtx));
//proj_destroy(target_crs);
proj_context_destroy(pjCtx);
return PointXY{};
}
PJ_COORD coordIn, coordOut;
coordIn.xy.x = point.x();
coordIn.xy.y = point.y();
coordOut = proj_trans(pjLonlat, PJ_INV, coordIn);
if (proj_errno(pjLonlat)) {
qWarning() << u8"convert unsucessfully from point in target project coodination to point in EPSG:4326=>" << point;
proj_destroy(pjLonlat);
//proj_destroy(target_crs);
proj_context_destroy(pjCtx);
return PointXY{};
}
//proj_destroy(target_crs);
proj_destroy(pjLonlat);
proj_context_destroy(pjCtx);
return PointXY{ coordOut.lpzt.lam * RAD_TO_DEG, coordOut.lpzt.phi * RAD_TO_DEG };
}
}

View File

@ -0,0 +1,55 @@
#pragma once
#include <QRectF>
#include <QString>
#include <pointxy.h>
namespace LAMPMainWidget
{
class CRS
{
public:
CRS() = default;
virtual ~CRS() = default;
public:
/**
* wgs84
* @param point
* @return wgs84
*/
virtual PointXY forward(const PointXY& point) const;
/**
* wgs84
* @param point
* @return wgs84
*/
virtual PointXY inverse(const PointXY& point) const;
/**
* proj4
* @return
*/
virtual QString proj4Cvt() const = 0;
/**
* wkt
* @return wkt
*/
virtual QString wktDef() const = 0;
/**
* proj4
* @return proj4
*/
virtual QString proj4Def() const = 0;
/**
*
* @return
*/
virtual QRectF extent() const = 0;
};
}

View File

@ -0,0 +1,21 @@
#include <QtCore/QString>
#include <gaodenormalprovider.h>
#pragma execution_character_set("utf-8")
namespace LAMPMainWidget {
GaodeNormalProvider::GaodeNormalProvider(QObject *parent)
: TmsProvider(parent) {
initCache();
}
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);
}
//http://wprd01.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=6
}

Some files were not shown because too many files have changed in this diff Show More