Updating GraphingInterfaces to use Graphing Engine 2.0 (#561)

* Updated Graphing Interfaces to version 2.0.1
This commit is contained in:
Stephanie Anderl 2019-06-21 13:17:39 -07:00 committed by GitHub
parent 5ffe1bc858
commit c3c001af28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 80 additions and 7 deletions

View File

@ -326,18 +326,24 @@ namespace Graphing
// Zoom out on all axes by the predefined ratio // Zoom out on all axes by the predefined ratio
ZoomOut, ZoomOut,
// Zoom out on X axis only, leave the range of Y unchanged // Zoom out on X axis only, leave the range of Y (and Z in 3D) unchanged
WidenX, WidenX,
// Zoom in on X axis only, leave the range of Y unchanged // Zoom in on X axis only, leave the range of Y (and Z in 3D) unchanged
ShrinkX, ShrinkX,
// Zoom out on Y axis only, leave the range of X unchanged // Zoom out on Y axis only, leave the range of X (and Z in 3D) unchanged
WidenY, WidenY,
// Zoom in on Y axis only, leave the range of X unchanged // Zoom in on Y axis only, leave the range of X (and Z in 3D) unchanged
ShrinkY, ShrinkY,
// Zoom out on Z axis only, leave the range of X and Y unchanged. Apply to 3D graph only but not 2D graph.
WidenZ,
// Zoom in on Z axis only, leave the range of X and Y unchanged. Apply to 3D graph only but not 2D graph.
ShrinkZ,
// Move the view window of the graph towards the negative X axis. // Move the view window of the graph towards the negative X axis.
MoveNegativeX, MoveNegativeX,
@ -350,6 +356,12 @@ namespace Graphing
// Move the view window of the graph towards the positive Y axis. // Move the view window of the graph towards the positive Y axis.
MovePositiveY, MovePositiveY,
// Move the view window of the graph towards the negative Z axis.
MoveNegativeZ,
// Move the view window of the graph towards the positive Z axis.
MovePositiveZ,
// Zoom in on all axes by the predefined ratio. The ratio is smaller than used in ZoomIn result in a smoother motion // Zoom in on all axes by the predefined ratio. The ratio is smaller than used in ZoomIn result in a smoother motion
SmoothZoomIn, SmoothZoomIn,

View File

@ -0,0 +1,19 @@
#pragma once
#include "Common.h"
#include "IEquationOptions.h"
namespace Graphing
{
struct IEquation : public NonCopyable, public NonMoveable
{
virtual ~IEquation() = default;
virtual std::shared_ptr<IEquationOptions> GetGraphEquationOptions() const = 0;
virtual unsigned int GetGraphEquationID() const = 0;
virtual bool TrySelectEquation() = 0;
virtual bool IsEquationSelected() const = 0;
};
}

View File

@ -0,0 +1,36 @@
#pragma once
#include "Common.h"
#include "GraphingEnums.h"
namespace Graphing
{
struct IEquationOptions : public NonCopyable, public NonMoveable
{
virtual ~IEquationOptions() = default;
virtual Graphing::Color GetGraphColor() const = 0;
virtual void SetGraphColor(const Graphing::Color& color) = 0;
virtual void ResetGraphColor() = 0;
virtual Graphing::Renderer::LineStyle GetLineStyle() const = 0;
virtual void SetLineStyle(Graphing::Renderer::LineStyle value) = 0;
virtual void ResetLineStyle() = 0;
virtual float GetLineWidth() const = 0;
virtual void SetLineWidth(float value) = 0;
virtual void ResetLineWidth() = 0;
virtual float GetSelectedEquationLineWidth() const = 0;
virtual void SetSelectedEquationLineWidth(float value) = 0;
virtual void ResetSelectedEquationLineWidth() = 0;
virtual float GetPointRadius() const = 0;
virtual void SetPointRadius(float value) = 0;
virtual void ResetPointRadius() = 0;
virtual float GetSelectedEquationPointRadius() const = 0;
virtual void SetSelectedEquationPointRadius(float value) = 0;
virtual void ResetSelectedEquationPointRadius() = 0;
};
}

View File

@ -3,6 +3,8 @@
#include "Common.h" #include "Common.h"
#include "IGraphingOptions.h" #include "IGraphingOptions.h"
#include "IGraphRenderer.h" #include "IGraphRenderer.h"
#include "IEquation.h"
#include <optional>
namespace Graphing namespace Graphing
{ {
@ -10,10 +12,12 @@ namespace Graphing
{ {
virtual ~IGraph() = default; virtual ~IGraph() = default;
virtual bool TryInitialize(const IExpression* graphingExp) = 0; virtual std::optional<std::vector<std::shared_ptr<IEquation>>> TryInitialize(const IExpression* graphingExp) = 0;
virtual IGraphingOptions& GetOptions() = 0; virtual IGraphingOptions& GetOptions() = 0;
virtual std::shared_ptr< Renderer::IGraphRenderer > GetRenderer() const = 0; virtual std::shared_ptr< Renderer::IGraphRenderer > GetRenderer() const = 0;
virtual bool TryResetSelection() = 0;
}; };
} }

View File

@ -16,7 +16,7 @@ namespace Graphing::Renderer
virtual HRESULT DrawD2D1(ID2D1Factory* pDirect2dFactory, ID2D1RenderTarget* pRenderTarget, bool& hasSomeMissingDataOut) = 0; virtual HRESULT DrawD2D1(ID2D1Factory* pDirect2dFactory, ID2D1RenderTarget* pRenderTarget, bool& hasSomeMissingDataOut) = 0;
virtual HRESULT GetClosePointData(float inScreenPointX, float inScreenPointY, int& formulaIdOut, float& xScreenPointOut, float& yScreenPointOut, float& xValueOut, float& yValueOut) = 0; virtual HRESULT GetClosePointData(float inScreenPointX, float inScreenPointY, int& formulaIdOut, float& xScreenPointOut, float& yScreenPointOut, float& xValueOut, float& yValueOut) = 0;
virtual HRESULT ScaleRange(double centerX, double centerY, double scale) = 0; virtual HRESULT ScaleRange(double centerX, double centerY, double scale) = 0;
virtual HRESULT ChangeRange(ChangeRangeAction action) = 0; virtual HRESULT ChangeRange(ChangeRangeAction action) = 0;
virtual HRESULT MoveRangeByRatio(double ratioX, double ratioY) = 0; virtual HRESULT MoveRangeByRatio(double ratioX, double ratioY) = 0;

View File

@ -273,6 +273,8 @@
<ClInclude Include="..\GraphingInterfaces\IGraphingOptions.h" /> <ClInclude Include="..\GraphingInterfaces\IGraphingOptions.h" />
<ClInclude Include="..\GraphingInterfaces\IGraphRenderer.h" /> <ClInclude Include="..\GraphingInterfaces\IGraphRenderer.h" />
<ClInclude Include="..\GraphingInterfaces\IMathSolver.h" /> <ClInclude Include="..\GraphingInterfaces\IMathSolver.h" />
<ClInclude Include="..\GraphingInterfaces\IEquation.h" />
<ClInclude Include="..\GraphingInterfaces\IEquationOptions.h" />
<ClInclude Include="Mocks\MathSolver.h" /> <ClInclude Include="Mocks\MathSolver.h" />
<ClInclude Include="pch.h" /> <ClInclude Include="pch.h" />
<ClInclude Include="targetver.h" /> <ClInclude Include="targetver.h" />
@ -294,4 +296,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>