Key graph features (#704)
* Added IGraphAnalyzer * Key Graph Features called and getting returned to the client. To do put all strings into the Equation object * Updated UpdateKeyGraphFeatures to add function analysis data to all properties in Equation object * Update KGF when variables are updated * Key graph features ui started * Added MathRichEditBox and started hooking up key graph features to the UI * Updated EquationViewModel to include parity and periodicity * Updated key graph features to update the EquationViewModel * updated key graph features to display more values * Key graph features populating uing MathRichEdit mode * moved KeyGraphFeatures control to GraphingCalculator.xaml * Use MathML formatting instead of MathRichEdit for strings passed back from the engine * cleaned up project targeting and equation.h comments * Updated equation edit box to populate for KeyGraphFeatures * Fixed vcxproj files to have the correct targeting and certificates. KGF Title strings moved to x:Uid instead of the code behind * Updated per PR feedback * Update MathRichEditBox to detect if the string is a mathml string and use the appropriate set method to set the text * fixed the issue where parity, periodicity and monotonicity could be set with an old value if the next one is empty * KGF control UI adjustments and error handling * Error control updates * Error handling added when analysis fails * fixed alignment on rich edit boxes * Add monotonicity direction into the mathml string and only have 1 richeditbox * Set hover state on KGF EquationEditBox to change button opacity and fixed spacing in Monotonicity RichEditBox * remove sideload package certificate info VS added * updated logic for setting error strings to be in the viewmodel * Updated KeyGraphFeatures to populate dynamically using a ListView and TemplateSelector * Update periodicity to not show if it isn't supported * Fixed issue where y-intercept was using the x-intercept value * Remove ItemsControl ItemsContainerStyle * Updated per pr feedback. Fixed bug where analysis error would not reset * Update MathRichEdit box to remove selection when focus is lost * Updated mathrichedit to get LAF access for Dev, Release and Graphing projects * Remove OnLostFocus in MathRichEdit, Change KGF ItemsControl back to ListView * Clean up styles for KGF and ensure the match the comps * Moved formatoptions logic to the Grapher constructor and reverted LineColor.Text resource that was mistakenly taken out * Add copyright header to KGF Files * fixed issue where asymptote values were not populating * Disable KGF button when there is no equation. Fixed issue where equation populated in a new equationtextbox after the previous one was deleted * Removed formatoptions testing lines used for debugging
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#ifndef GRAPHINGAPI
|
||||
#ifdef GRAPHING_ENGINE_IMPL
|
||||
#define GRAPHINGAPI __declspec(dllexport)
|
||||
|
@@ -384,4 +384,189 @@ namespace Graphing
|
||||
DashDotDot
|
||||
};
|
||||
}
|
||||
|
||||
namespace Analyzer {
|
||||
|
||||
// Graph Analyzer Messages
|
||||
enum GraphAnalyzerMessage
|
||||
{
|
||||
// "No data"
|
||||
GraphAnalyzerMessage_None = 0,
|
||||
|
||||
// "No zeros"
|
||||
GraphAnalyzerMessage_NoZeros = 1,
|
||||
|
||||
// "No y-intercept"
|
||||
GraphAnalyzerMessage_NoYIntercept = 2,
|
||||
|
||||
// "No minima"
|
||||
GraphAnalyzerMessage_NoMinima = 3,
|
||||
|
||||
// "No maxima"
|
||||
GraphAnalyzerMessage_NoMaxima = 4,
|
||||
|
||||
// "No inflection points"
|
||||
GraphAnalyzerMessage_NoInflectionPoints = 5,
|
||||
|
||||
// "No vertical asymptotes"
|
||||
GraphAnalyzerMessage_NoVerticalAsymptotes = 6,
|
||||
|
||||
// "No horizontal asymptotes"
|
||||
GraphAnalyzerMessage_NoHorizontalAsymptotes = 7,
|
||||
|
||||
// "No oblique asymptotes"
|
||||
GraphAnalyzerMessage_NoObliqueAsymptotes = 8,
|
||||
|
||||
// "Not able to calculate"
|
||||
GraphAnalyzerMessage_NotAbleToCalculate = 9,
|
||||
|
||||
// "Not able to mark all graph features"
|
||||
GraphAnalyzerMessage_NotAbleToMarkAllGraphFeatures = 10,
|
||||
|
||||
// These features are too complex for {APPLICATION_NAME} to calculate
|
||||
GraphAnalyzerMessage_TheseFeaturesAreTooComplexToCalculate = 11,
|
||||
|
||||
// "This feature is too complex for {APPLICATION_NAME} to calculate"
|
||||
GraphAnalyzerMessage_ThisFeatureIsTooComplexToCalculate = 12
|
||||
};
|
||||
|
||||
// define which data should be filled into result object
|
||||
enum AnalysisType
|
||||
{
|
||||
// fill domain data
|
||||
AnalysisType_Domain = 0,
|
||||
|
||||
// fill range data
|
||||
AnalysisType_Range = 1,
|
||||
|
||||
// fill parity data
|
||||
AnalysisType_Parity = 2,
|
||||
|
||||
// fill zeros
|
||||
AnalysisType_Zeros = 3,
|
||||
|
||||
// fill interception with y axis
|
||||
AnalysisType_YIntercept = 4,
|
||||
|
||||
// fill minima
|
||||
AnalysisType_Minima = 5,
|
||||
|
||||
// fill maxima
|
||||
AnalysisType_Maxima = 6,
|
||||
|
||||
// fill inflection points
|
||||
AnalysisType_InflectionPoints = 7,
|
||||
|
||||
// fill vertical asymptotes
|
||||
AnalysisType_VerticalAsymptotes = 8,
|
||||
|
||||
// fill horizontal asymptotes
|
||||
AnalysisType_HorizontalAsymptotes = 9,
|
||||
|
||||
// fill oblique asymptotes
|
||||
AnalysisType_ObliqueAsymptotes = 10,
|
||||
|
||||
// fill monotonicity
|
||||
AnalysisType_Monotonicity = 11,
|
||||
|
||||
// fill period
|
||||
AnalysisType_Period = 12
|
||||
};
|
||||
|
||||
// define which additional data should be calculated
|
||||
enum class PerformAnalysisType
|
||||
{
|
||||
// Calculate nothing
|
||||
//PerformAnalysisType_None = 0x0,
|
||||
|
||||
// Calculate domain data
|
||||
PerformAnalysisType_Domain = 0x01,
|
||||
|
||||
// Calculate range data
|
||||
PerformAnalysisType_Range = 0x02,
|
||||
|
||||
// Calculate parity data
|
||||
PerformAnalysisType_Parity = 0x04,
|
||||
|
||||
// Calculate zeros and interception with y axis
|
||||
PerformAnalysisType_InterceptionPointsWithXAndYAxis = 0x08,
|
||||
|
||||
// Calculate Extrema and inflection points
|
||||
PerformAnalysisType_CriticalPoints = 0x10,
|
||||
|
||||
// Calculate asymptotes
|
||||
PerformAnalysisType_Asymptotes = 0x20,
|
||||
|
||||
// Calculate monotonicity
|
||||
PerformAnalysisType_Monotonicity = 0x40,
|
||||
|
||||
// Calculate period
|
||||
PerformAnalysisType_Period = 0x80,
|
||||
|
||||
// Calculate all additional data
|
||||
PerformAnalysisType_All = 0xFF
|
||||
};
|
||||
|
||||
// function parity for function analysis
|
||||
enum class FunctionParityType
|
||||
{
|
||||
// parity not calculated or not possible to calculate
|
||||
FunctionParityType_Unknown = 0,
|
||||
|
||||
// parity is odd
|
||||
FunctionParityType_Odd = 1,
|
||||
|
||||
// parity is even
|
||||
FunctionParityType_Even = 2,
|
||||
|
||||
// function is not odd nor even
|
||||
FunctionParityType_None = 3
|
||||
};
|
||||
|
||||
// monotonicity direction for function analysis
|
||||
enum class FunctionMonotonicityType
|
||||
{
|
||||
// unknown or not calculated
|
||||
FunctionMonotonicityType_Unknown = 0,
|
||||
|
||||
// ascending monotonicity on interval
|
||||
FunctionMonotonicityType_Ascending = 1,
|
||||
|
||||
// descending monotonicity on interval
|
||||
FunctionMonotonicityType_Descending = 2,
|
||||
|
||||
// constant monotonicity on interval
|
||||
FunctionMonotonicityType_Constant = 3
|
||||
};
|
||||
|
||||
// asymptote description for function analysis
|
||||
enum class AsymptoteType
|
||||
{
|
||||
// unknown or not calculated
|
||||
AsymptoteType_Unknown = 0,
|
||||
|
||||
// when x goes to positive infinity
|
||||
AsymptoteType_PositiveInfinity = 1,
|
||||
|
||||
// when x goes to negative infinity
|
||||
AsymptoteType_NegativeInfinity = 2,
|
||||
|
||||
// when x goes to positive or negative infinity
|
||||
AsymptoteType_AnyInfinity = 3
|
||||
};
|
||||
|
||||
// function periodicity for function analysis
|
||||
enum class FunctionPeriodicityType
|
||||
{
|
||||
// periodicity not calculated or not possible to calculate
|
||||
FunctionPeriodicityType_Unknown = 0,
|
||||
|
||||
// parity is odd
|
||||
FunctionPeriodicityType_Periodic = 1,
|
||||
|
||||
// parity is even
|
||||
FunctionPeriodicityType_NotPeriodic = 2
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -4,8 +4,8 @@
|
||||
|
||||
namespace Graphing
|
||||
{
|
||||
struct IBitmap
|
||||
struct IBitmap
|
||||
{
|
||||
virtual const std::vector<BYTE>& GetData() const = 0;
|
||||
};
|
||||
virtual const std::vector<BYTE>& GetData() const = 0;
|
||||
};
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Common.h"
|
||||
#include "IGraphAnalyzer.h"
|
||||
#include "IGraphingOptions.h"
|
||||
#include "IGraphRenderer.h"
|
||||
#include "IEquation.h"
|
||||
@@ -16,12 +17,14 @@ namespace Graphing
|
||||
|
||||
virtual IGraphingOptions& GetOptions() = 0;
|
||||
|
||||
virtual std::vector<std::shared_ptr<IVariable>> GetVariables() = 0;
|
||||
virtual std::vector<std::shared_ptr<Graphing::IVariable>> GetVariables() = 0;
|
||||
|
||||
virtual void SetArgValue(std::wstring variableName, double value) = 0;
|
||||
|
||||
virtual std::shared_ptr< Renderer::IGraphRenderer > GetRenderer() const = 0;
|
||||
virtual std::shared_ptr<Renderer::IGraphRenderer> GetRenderer() const = 0;
|
||||
|
||||
virtual bool TryResetSelection() = 0;
|
||||
|
||||
virtual std::shared_ptr< Graphing::Analyzer::IGraphAnalyzer > GetAnalyzer() const = 0;
|
||||
};
|
||||
}
|
||||
|
21
src/GraphingInterfaces/IGraphAnalyzer.h
Normal file
21
src/GraphingInterfaces/IGraphAnalyzer.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "Common.h"
|
||||
#include "GraphingEnums.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace Graphing::Analyzer
|
||||
{
|
||||
typedef unsigned int NativeAnalysisType; // PerformAnalysisType
|
||||
|
||||
struct IGraphAnalyzer : public NonCopyable, public NonMoveable
|
||||
{
|
||||
virtual ~IGraphAnalyzer() = default;
|
||||
virtual bool CanFunctionAnalysisBePerformed() = 0;
|
||||
virtual HRESULT PerformFunctionAnalysis(NativeAnalysisType analysisType) = 0;
|
||||
virtual HRESULT GetAnalysisTypeCaption(const AnalysisType type, std::wstring& captionOut) const = 0;
|
||||
virtual HRESULT GetMessage(const GraphAnalyzerMessage msg, std::wstring& msgOut) const = 0;
|
||||
};
|
||||
}
|
@@ -1,11 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "Common.h"
|
||||
#include "IBitmap.h"
|
||||
|
||||
struct ID2D1Factory;
|
||||
struct ID2D1RenderTarget;
|
||||
|
||||
namespace Graphing
|
||||
{
|
||||
struct IBitmap;
|
||||
}
|
||||
|
||||
namespace Graphing::Renderer
|
||||
{
|
||||
struct IGraphRenderer : public NonCopyable, public NonMoveable
|
||||
|
@@ -2,10 +2,30 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "IGraph.h"
|
||||
#include "IGraphAnalyzer.h"
|
||||
#include "GraphingEnums.h"
|
||||
|
||||
namespace Graphing
|
||||
{
|
||||
struct IGraphFunctionAnalysisData
|
||||
{
|
||||
std::wstring Domain;
|
||||
std::wstring Range;
|
||||
int Parity;
|
||||
int PeriodicityDirection;
|
||||
std::wstring PeriodicityExpression;
|
||||
std::wstring Zeros;
|
||||
std::wstring YIntercept;
|
||||
std::vector<std::wstring> Minima;
|
||||
std::vector<std::wstring> Maxima;
|
||||
std::vector<std::wstring> InflectionPoints;
|
||||
std::vector<std::wstring> VerticalAsymptotes;
|
||||
std::vector<std::wstring> HorizontalAsymptotes;
|
||||
std::vector<std::wstring> ObliqueAsymptotes;
|
||||
std::map<std::wstring, int> MonotoneIntervals;
|
||||
int TooComplexFeatures; // to-do: refactor to remove bitwise flag
|
||||
};
|
||||
|
||||
struct IParsingOptions : public NonCopyable, public NonMoveable
|
||||
{
|
||||
virtual ~IParsingOptions() = default;
|
||||
@@ -23,6 +43,7 @@ namespace Graphing
|
||||
virtual ~IFormatOptions() = default;
|
||||
|
||||
virtual void SetFormatType(FormatType type) = 0;
|
||||
virtual void SetMathMLPrefix(const std::wstring& value) = 0;
|
||||
};
|
||||
|
||||
struct IMathSolver : public NonCopyable, public NonMoveable
|
||||
@@ -41,5 +62,7 @@ namespace Graphing
|
||||
virtual std::shared_ptr<Graphing::IGraph> CreateGrapher() = 0;
|
||||
|
||||
virtual std::wstring Serialize(const IExpression* expression) = 0;
|
||||
|
||||
virtual Graphing::IGraphFunctionAnalysisData Analyze(const Graphing::Analyzer::IGraphAnalyzer* analyzer) = 0;
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user