mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 09:50:40 +08:00
style: Core 全局格式化
This commit is contained in:
@@ -481,7 +481,6 @@ void asst::Assistant::call_proc()
|
||||
LogTraceFunction;
|
||||
|
||||
while (!m_thread_exit) {
|
||||
|
||||
AsyncCallItem call_item;
|
||||
|
||||
{
|
||||
|
||||
@@ -98,7 +98,6 @@ void asst::InfrastProductionTask::change_product()
|
||||
break;
|
||||
}
|
||||
case infrast::CustomRoomConfig::Product::Dualchip: {
|
||||
|
||||
break;
|
||||
}
|
||||
/*贸易站的订单类型*/
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#include "Controller/Controller.h"
|
||||
#include "Task/ProcessTask.h"
|
||||
#include "Utils/Logger.hpp"
|
||||
#include "Vision/MultiMatchImageAnalyzer.h"
|
||||
#include "Vision/Infrast/InfrastClueVacancyImageAnalyzer.h"
|
||||
#include "Vision/MatchImageAnalyzer.h"
|
||||
#include "Vision/MultiMatchImageAnalyzer.h"
|
||||
|
||||
bool asst::InfrastReceptionTask::_run()
|
||||
{
|
||||
|
||||
@@ -9,16 +9,17 @@ namespace asst::utils
|
||||
concept ByteValueType = std::is_integral_v<ValueType> && sizeof(ValueType) == 1;
|
||||
|
||||
template <typename ContainerType>
|
||||
concept AppendableBytesContainer = requires(ContainerType a) {
|
||||
requires ranges::contiguous_range<ContainerType>;
|
||||
requires ByteValueType<typename ContainerType::value_type>;
|
||||
requires std::is_constructible_v<ContainerType>;
|
||||
requires std::is_constructible_v<ContainerType, size_t,
|
||||
typename ContainerType::value_type>; // std::string(count, ch),
|
||||
// std::vector(count, value)
|
||||
a.insert(a.end(), a.begin(), a.begin() + (size_t)1);
|
||||
a.resize(a.size());
|
||||
};
|
||||
concept AppendableBytesContainer =
|
||||
requires(ContainerType a) {
|
||||
requires ranges::contiguous_range<ContainerType>;
|
||||
requires ByteValueType<typename ContainerType::value_type>;
|
||||
requires std::is_constructible_v<ContainerType>;
|
||||
requires std::is_constructible_v<ContainerType, size_t,
|
||||
typename ContainerType::value_type>; // std::string(count, ch),
|
||||
// std::vector(count, value)
|
||||
a.insert(a.end(), a.begin(), a.begin() + (size_t)1);
|
||||
a.resize(a.size());
|
||||
};
|
||||
|
||||
template <AppendableBytesContainer ContainerType>
|
||||
ContainerType read_file(const std::filesystem::path& path)
|
||||
|
||||
@@ -91,4 +91,3 @@ bool AbstractImageAnalyzer::save_img(const std::filesystem::path& relative_dir)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,5 +109,4 @@ namespace asst
|
||||
return lvalue < rvalue;
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace asst
|
||||
|
||||
@@ -17,7 +17,8 @@ namespace asst
|
||||
struct Result
|
||||
{
|
||||
std::string to_string() const
|
||||
{ return "{ name: " + templ_info.name + ", matched: " + rect.to_string() + " }";
|
||||
{
|
||||
return "{ name: " + templ_info.name + ", matched: " + rect.to_string() + " }";
|
||||
}
|
||||
explicit operator std::string() const { return to_string(); }
|
||||
|
||||
@@ -48,5 +49,4 @@ namespace asst
|
||||
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
|
||||
mutable Result m_result;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -44,4 +44,3 @@ void MatcherConfig::_set_task_info(MatchTaskInfo task_info)
|
||||
|
||||
_set_roi(task_info.roi);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
namespace asst
|
||||
{
|
||||
|
||||
class MatcherConfig
|
||||
{
|
||||
public:
|
||||
@@ -41,5 +40,4 @@ namespace asst
|
||||
protected:
|
||||
Params m_params;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -49,5 +49,4 @@ namespace asst
|
||||
protected:
|
||||
Params m_params;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@ MatchImageAnalyzer::ResultOpt MatchImageAnalyzer::analyze() const
|
||||
return m_result;
|
||||
}
|
||||
|
||||
MatchImageAnalyzer::RawResult MatchImageAnalyzer::preproc_and_match(const cv::Mat& image, const MatcherConfig::Params& params)
|
||||
MatchImageAnalyzer::RawResult MatchImageAnalyzer::preproc_and_match(const cv::Mat& image,
|
||||
const MatcherConfig::Params& params)
|
||||
{
|
||||
cv::Mat templ;
|
||||
std::string templ_name;
|
||||
@@ -87,4 +88,3 @@ MatchImageAnalyzer::RawResult MatchImageAnalyzer::preproc_and_match(const cv::Ma
|
||||
|
||||
return RawResult { .matched = matched, .templ = templ, .templ_name = templ_name };
|
||||
}
|
||||
|
||||
|
||||
@@ -3,37 +3,36 @@
|
||||
|
||||
#include "Vision/Config/MatcherConfig.h"
|
||||
|
||||
namespace asst {
|
||||
|
||||
class MatchImageAnalyzer : public AbstractImageAnalyzer, public MatcherConfig
|
||||
namespace asst
|
||||
{
|
||||
class MatchImageAnalyzer : public AbstractImageAnalyzer, public MatcherConfig
|
||||
{
|
||||
public:
|
||||
using Result = MatchRect;
|
||||
using ResultOpt = std::optional<Result>;
|
||||
public:
|
||||
using Result = MatchRect;
|
||||
using ResultOpt = std::optional<Result>;
|
||||
|
||||
public:
|
||||
using AbstractImageAnalyzer::AbstractImageAnalyzer;
|
||||
virtual ~MatchImageAnalyzer() override = default;
|
||||
public:
|
||||
using AbstractImageAnalyzer::AbstractImageAnalyzer;
|
||||
virtual ~MatchImageAnalyzer() override = default;
|
||||
|
||||
ResultOpt analyze() const;
|
||||
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
|
||||
const auto& get_result() const noexcept { return m_result; }
|
||||
ResultOpt analyze() const;
|
||||
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
|
||||
const auto& get_result() const noexcept { return m_result; }
|
||||
|
||||
public:
|
||||
struct RawResult
|
||||
{
|
||||
cv::Mat matched;
|
||||
cv::Mat templ;
|
||||
std::string templ_name;
|
||||
public:
|
||||
struct RawResult
|
||||
{
|
||||
cv::Mat matched;
|
||||
cv::Mat templ;
|
||||
std::string templ_name;
|
||||
};
|
||||
static RawResult preproc_and_match(const cv::Mat& image, const MatcherConfig::Params& params);
|
||||
|
||||
protected:
|
||||
virtual void _set_roi(const Rect& roi) override { set_roi(roi); }
|
||||
|
||||
private:
|
||||
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
|
||||
mutable Result m_result;
|
||||
};
|
||||
static RawResult preproc_and_match(const cv::Mat& image, const MatcherConfig::Params& params);
|
||||
|
||||
protected:
|
||||
virtual void _set_roi(const Rect& roi) override { set_roi(roi); }
|
||||
|
||||
private:
|
||||
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
|
||||
mutable Result m_result;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -77,4 +77,3 @@ MultiMatchImageAnalyzer::ResultsVecOpt MultiMatchImageAnalyzer::analyze() const
|
||||
m_result = std::move(results);
|
||||
return m_result;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,29 +2,28 @@
|
||||
#include "AbstractImageAnalyzer.h"
|
||||
#include "Vision/Config/MatcherConfig.h"
|
||||
|
||||
namespace asst {
|
||||
|
||||
class MultiMatchImageAnalyzer : public AbstractImageAnalyzer, public MatcherConfig
|
||||
namespace asst
|
||||
{
|
||||
class MultiMatchImageAnalyzer : public AbstractImageAnalyzer, public MatcherConfig
|
||||
{
|
||||
public:
|
||||
using Result = MatchRect;
|
||||
using ResultsVec = std::vector<Result>;
|
||||
using ResultsVecOpt = std::optional<ResultsVec>;
|
||||
public:
|
||||
using Result = MatchRect;
|
||||
using ResultsVec = std::vector<Result>;
|
||||
using ResultsVecOpt = std::optional<ResultsVec>;
|
||||
|
||||
public:
|
||||
using AbstractImageAnalyzer::AbstractImageAnalyzer;
|
||||
virtual ~MultiMatchImageAnalyzer() override = default;
|
||||
public:
|
||||
using AbstractImageAnalyzer::AbstractImageAnalyzer;
|
||||
virtual ~MultiMatchImageAnalyzer() override = default;
|
||||
|
||||
ResultsVecOpt analyze() const;
|
||||
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
|
||||
const auto& get_result() const noexcept { return m_result; }
|
||||
ResultsVecOpt analyze() const;
|
||||
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
|
||||
const auto& get_result() const noexcept { return m_result; }
|
||||
|
||||
protected:
|
||||
virtual void _set_roi(const Rect& roi) override { set_roi(roi); }
|
||||
|
||||
private:
|
||||
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
|
||||
mutable ResultsVec m_result;
|
||||
};
|
||||
protected:
|
||||
virtual void _set_roi(const Rect& roi) override { set_roi(roi); }
|
||||
|
||||
private:
|
||||
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
|
||||
mutable ResultsVec m_result;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
namespace asst
|
||||
{
|
||||
|
||||
class OcrImageAnalyzer : public AbstractImageAnalyzer, public OCRerConfig
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -43,5 +43,4 @@ namespace asst
|
||||
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
|
||||
mutable ResultsVec m_result;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -45,4 +45,3 @@ OcrWithPreprocessImageAnalyzer::ResultOpt OcrWithPreprocessImageAnalyzer::analyz
|
||||
m_result = result->front();
|
||||
return m_result;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,5 +24,4 @@ namespace asst
|
||||
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
|
||||
mutable Result m_result;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user