forked from microsoft/calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Graph.h
71 lines (59 loc) · 1.95 KB
/
Graph.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include "GraphingInterfaces/IGraph.h"
#include "GraphingOptions.h"
#include "Mocks/GraphRenderer.h"
namespace MockGraphingImpl
{
class Graph : public Graphing::IGraph
{
public:
Graph()
{
m_graphRenderer = std::make_shared<GraphRenderer>();
}
virtual std::optional<std::vector<std::shared_ptr<Graphing::IEquation>>> TryInitialize(const Graphing::IExpression* graphingExp = nullptr)
{
if (graphingExp != nullptr)
{
std::vector<std::shared_ptr<Graphing::IEquation>> equations;
equations.push_back(nullptr);
m_variables.push_back(std::make_shared<MockVariable>(MockVariable{}));
return std::optional<std::vector<std::shared_ptr<Graphing::IEquation>>>(equations);
}
return std::nullopt;
}
HRESULT GetInitializationError()
{
return S_OK;
}
virtual Graphing::IGraphingOptions& GetOptions()
{
return m_graphingOptions;
}
virtual std::vector<std::shared_ptr<Graphing::IVariable>> GetVariables()
{
return m_variables;
}
virtual void SetArgValue(std::wstring variableName, double value)
{
}
virtual std::shared_ptr<Graphing::Renderer::IGraphRenderer> GetRenderer() const
{
return m_graphRenderer;
}
virtual bool TryResetSelection()
{
return true;
}
virtual std::shared_ptr<Graphing::Analyzer::IGraphAnalyzer> GetAnalyzer() const
{
return nullptr;
}
private:
std::vector<std::shared_ptr<Graphing::IVariable>> m_variables;
GraphingOptions m_graphingOptions;
std::shared_ptr<Graphing::Renderer::IGraphRenderer> m_graphRenderer;
};
}