Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating GraphingInterfaces to use Graphing Engine 2.0 #561

Merged
merged 2 commits into from
Jun 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/GraphingInterfaces/GraphingEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,18 +326,24 @@ namespace Graphing
// Zoom out on all axes by the predefined ratio
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,

// 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,

// 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,

// 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,

// 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.
MoveNegativeX,

Expand All @@ -350,6 +356,12 @@ namespace Graphing
// Move the view window of the graph towards the positive Y axis.
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
SmoothZoomIn,

Expand Down
19 changes: 19 additions & 0 deletions src/GraphingInterfaces/IEquation.h
Original file line number Diff line number Diff line change
@@ -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;
};
}
36 changes: 36 additions & 0 deletions src/GraphingInterfaces/IEquationOptions.h
Original file line number Diff line number Diff line change
@@ -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;
};
}
6 changes: 5 additions & 1 deletion src/GraphingInterfaces/IGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@
#include "Common.h"
#include "IGraphingOptions.h"
#include "IGraphRenderer.h"
#include "IEquation.h"
#include <optional>

namespace Graphing
{
struct IGraph : public NonCopyable, public NonMoveable
{
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 std::shared_ptr< Renderer::IGraphRenderer > GetRenderer() const = 0;

virtual bool TryResetSelection() = 0;
};
}
2 changes: 1 addition & 1 deletion src/GraphingInterfaces/IGraphRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Graphing::Renderer

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 ScaleRange(double centerX, double centerY, double scale) = 0;
virtual HRESULT ChangeRange(ChangeRangeAction action) = 0;
virtual HRESULT MoveRangeByRatio(double ratioX, double ratioY) = 0;
Expand Down
4 changes: 3 additions & 1 deletion src/MockGraphingImpl/MockGraphingImpl.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@
<ClInclude Include="..\GraphingInterfaces\IGraphingOptions.h" />
<ClInclude Include="..\GraphingInterfaces\IGraphRenderer.h" />
<ClInclude Include="..\GraphingInterfaces\IMathSolver.h" />
<ClInclude Include="..\GraphingInterfaces\IEquation.h" />
<ClInclude Include="..\GraphingInterfaces\IEquationOptions.h" />
<ClInclude Include="Mocks\MathSolver.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="targetver.h" />
Expand All @@ -294,4 +296,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>