Commit 84ec23b4 authored by 刘乐's avatar 刘乐

1,ddd

parent 3e8647f9
......@@ -25,7 +25,7 @@ void CivConTrackTest::test(char* uri)
char sn[32];
strcpy_s(sn, "JD00000680");
int succ = trackingSimulation(uri, sn, 13, result);
int succ = trackingSimulation(uri, sn, 3, result);
std::cout << result << std::endl;
std::cout << "测试结果:" << succ << std::endl;
......
......@@ -24,12 +24,12 @@ int main(int argc, char* argv[])
context.contextTest(findUri);*/
// 测试追踪分析
/*CivTestContext context(new CivConTrackTest());
context.contextTest(findUri);*/
CivTestContext context(new CivConTrackTest());
context.contextTest(findUri);
// 测试根据时段获取值
CivTestContext context(new CivConGetDataTest());
context.contextTest(findUri);
/*CivTestContext context(new CivConGetDataTest());
context.contextTest(findUri);*/
getchar();
return 0;
......
......@@ -17,6 +17,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "funcDemo", "funcDemo\funcDe
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pandaLog", "pandaLog\pandaLog.vcxproj", "{4C38D294-830F-441E-B892-60117ABA8BFE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pandaAlgorithm", "pandaAlgorithm\pandaAlgorithm.vcxproj", "{B004F96E-D760-410C-B298-B6E0510E831E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -77,6 +79,16 @@ Global
{4C38D294-830F-441E-B892-60117ABA8BFE}.Release|x64.Build.0 = Release|x64
{4C38D294-830F-441E-B892-60117ABA8BFE}.Release|x86.ActiveCfg = Release|Win32
{4C38D294-830F-441E-B892-60117ABA8BFE}.Release|x86.Build.0 = Release|Win32
{B004F96E-D760-410C-B298-B6E0510E831E}.Debug|Any CPU.ActiveCfg = Debug|Win32
{B004F96E-D760-410C-B298-B6E0510E831E}.Debug|x64.ActiveCfg = Debug|x64
{B004F96E-D760-410C-B298-B6E0510E831E}.Debug|x64.Build.0 = Debug|x64
{B004F96E-D760-410C-B298-B6E0510E831E}.Debug|x86.ActiveCfg = Debug|Win32
{B004F96E-D760-410C-B298-B6E0510E831E}.Debug|x86.Build.0 = Debug|Win32
{B004F96E-D760-410C-B298-B6E0510E831E}.Release|Any CPU.ActiveCfg = Release|Win32
{B004F96E-D760-410C-B298-B6E0510E831E}.Release|x64.ActiveCfg = Release|x64
{B004F96E-D760-410C-B298-B6E0510E831E}.Release|x64.Build.0 = Release|x64
{B004F96E-D760-410C-B298-B6E0510E831E}.Release|x86.ActiveCfg = Release|Win32
{B004F96E-D760-410C-B298-B6E0510E831E}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
#include "CivGraph.h"
#pragma once
/*
ͼ
*/
template<class Item>
class CivDGraph
{
public:
};
<?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>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{b004f96e-d760-410c-b298-b6e0510e831e}</ProjectGuid>
<RootNamespace>pandaAlgorithm</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>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</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" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</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;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="CivGraph.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CivGraph.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?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++;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>
<ClInclude Include="CivGraph.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CivGraph.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
\ No newline at end of file
......@@ -57,6 +57,26 @@ char* CivHydrSimulation::getBinFile()
return const_cast<char*>(mBinFile.c_str());
}
std::string CivHydrSimulation::getAnalysisResults()
{
std::string result;
std::ifstream myfile(getRptFile());
if (myfile.is_open())
{
return result;
}
while (!myfile.eof())
{
myfile >> result;
}
myfile.close();
return result;
}
void CivHydrSimulation::setBinFile(const std::string& binFile)
{
mBinFile = binFile;
......@@ -380,81 +400,91 @@ void CivHydrSimulation::getTrackingResult(int hours, std::string& newresult)
{
std::string result;
result.append("[");
CivTrackingResultCache trackingCache;
trackingCache.cacheInfoFromDb(mDbConn);
std::stringstream stream;
for (int i = 0; i < hours; i++)
{
NodeResultItems nodeItemsMap;
LinkResultItems linkItemsMap;
mResultCache.getResultByTime(i, nodeItemsMap, linkItemsMap);
// 查找节点追踪的节点编号
std::string nodeTempText;
nodeTempText.append("[");
nodeTempText.append("{\"type\":\"污染源\",\"location\":[");
// 查找节点追踪的节点编号
auto nodeIter = nodeItemsMap.begin();
size_t nodeTotal = nodeItemsMap.size();
while (nodeIter != nodeItemsMap.end())
{
if (nodeIter->second.dQuality>0)
if (nodeIter->second.dQuality > 0)
{
nodeTempText.append("[");
nodeTempText.append("{\"value\":[");
std::string sn = nodeIter->first;
nodeTempText.append(sn.c_str());
Junctions junction;
trackingCache.getNodeInfoBySn(sn, junction);
nodeTempText.append(",");
nodeTempText.append(junction.xCoord);
nodeTempText.append(",");
nodeTempText.append(junction.yCoord);
nodeTempText.append("],");
nodeTempText.append("\"code\":");
nodeTempText.append(sn.c_str());
nodeTempText.append("},");
}
nodeIter++;
}
std::string newNodeTempText = nodeTempText.substr(0, nodeTempText.length() - 1);
newNodeTempText.append("]");
newNodeTempText.append("]}");
// 追踪管段编号
auto linkIter = linkItemsMap.begin();
size_t total = linkItemsMap.size();
int index = 1;
std::string linkTempText;
linkTempText.append("[");
linkTempText.append("{\"type\":\"污染管段\",\"location\":[");
while (linkIter != linkItemsMap.end())
{
if (linkIter->second.dQuality > 0)
{
std::string sn = linkIter->first;
linkTempText.append("[");
linkTempText.append(sn.c_str());
linkTempText.append("{\"coords\":[");
Pipes pipe;
trackingCache.getPipeInfoBySn(sn, pipe);
linkTempText.append(",");
linkTempText.append(pipe.startX);
linkTempText.append(",");
linkTempText.append("[");
linkTempText.append(pipe.startX);
linkTempText.append(",");
linkTempText.append(pipe.startY);
linkTempText.append("],");
linkTempText.append("[");
linkTempText.append(pipe.endX);
linkTempText.append(",");
linkTempText.append(pipe.endY);
linkTempText.append("],");
linkTempText.append("]");
linkTempText.append("]},");
}
linkIter++;
}
std::string newLinkTempText = linkTempText.substr(0, linkTempText.length() - 1);
newLinkTempText.append("]");
newLinkTempText.append("]}");
result.append("[");
result.append(newNodeTempText);
result.append("|");
result.append(",");
result.append(newLinkTempText);
result.append("],");
}
......
......@@ -29,6 +29,12 @@ public:
*/
bool qualitySimulation();
/**
*@brief 获取分析结果
*@return 分析结果字符串
*/
std::string getAnalysisResults();
/**
*@brief 追踪分析,本质仍然式水质分析
*@param snNode:追踪的节点号
......@@ -67,19 +73,18 @@ public:
*@brief 刷新最新的模拟的数据
*/
bool brushingResult();
/*
inp文件名,输出文件名,二进制文件名设置和获取
*/
inline char* getInpFile();
*/
inline void setInpFile(const std::string& inpFile);
inline char* getRptFile();
inline void setRptFile(const std::string& rptFile);
inline char* getBinFile();
inline void setRptFile(const std::string& rptFile);
inline void setBinFile(const std::string& binFile);
private:
inline char* getRptFile();
inline char* getInpFile();
inline char* getBinFile();
/**
*@brief 水质计算服务
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment